Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sshivaditya committed Jan 13, 2025
1 parent 6c750d1 commit 5c55f9b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .vscode/settings.json

This file was deleted.

8 changes: 1 addition & 7 deletions evals/handlers/setup-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { fetchRepoLanguageStats, fetchRepoDependencies } from "../../src/handler
import { findGroundTruths } from "../../src/handlers/ground-truths/find-ground-truths";
import { logger } from "../../src/helpers/errors";
import { formatChatHistory } from "../../src/helpers/format-chat-history";
import { recursivelyFetchLinkedIssues } from "../../src/helpers/issue-fetching";
import { Context } from "../../src/types";
import { VoyageAIClient } from "voyageai";
import OpenAI from "openai";
Expand Down Expand Up @@ -48,12 +47,7 @@ export async function fetchContext(context: Context, question: string): Promise<
voyage: { reranker },
},
} = context;
const { specAndBodies, streamlinedComments } = await recursivelyFetchLinkedIssues({
context,
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
});
let formattedChat = await formatChatHistory(context, streamlinedComments, specAndBodies);
let formattedChat = await formatChatHistory(context);
logger.info(`${formattedChat.join("")}`);
// using db functions to find similar comments and issues
const [similarComments, similarIssues] = await Promise.all([
Expand Down
10 changes: 5 additions & 5 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ describe("Ask plugin tests", () => {
expect(res?.answer).toBe(MOCK_ANSWER);
});


it("Should throw if OPENAI_API_KEY is not defined", () => {
const settings = {};
expect(() => Value.Decode(envSchema, settings)).toThrow(TransformDecodeCheckError);
Expand Down Expand Up @@ -113,9 +112,6 @@ describe("Ask plugin tests", () => {
"Body:",
` ${SPEC}`,
"",
"README:",
' {"content":"This is a mock README file"}',
"",
"Comments: 2",
`├── issuecomment-1: ubiquity: More context here #2 [#2](https://github.com/ubiquity/test-repo/issues/2)`,
`└── issuecomment-2: ubiquity: ${TEST_QUESTION} [#1](https://github.com/ubiquity/test-repo/issues/1)`,
Expand All @@ -130,6 +126,8 @@ describe("Ask plugin tests", () => {
" └── Issue #3 (https://github.com/ubiquity/test-repo/issues/3)",
" Body:",
` Just another issue`,
" Comments: 1",
` └── issuecomment-4: ubiquity: Just a comment [#1](https://github.com/ubiquity/test-repo/issues/1)`,
"",
].join("\n");

Expand Down Expand Up @@ -265,7 +263,9 @@ function createContext(body = TEST_QUESTION) {
owner: "ubiquity",
repo: "test-repo",
logger: logger,
config: {},
config: {
maxDepth: 5,
},
env: {
UBIQUITY_OS_APP_NAME: "UbiquityOS",
OPENAI_API_KEY: "test",
Expand Down

0 comments on commit 5c55f9b

Please sign in to comment.