-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbd06e6
commit b0f3e34
Showing
31 changed files
with
450 additions
and
654 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
26 changes: 0 additions & 26 deletions
26
JS/edgechains/arakoodev/src/db/src/lib/postgres-client/PostgresClient.d.ts
This file was deleted.
Oops, something went wrong.
94 changes: 0 additions & 94 deletions
94
JS/edgechains/arakoodev/src/db/src/lib/postgres-client/PostgresClient.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
JS/edgechains/arakoodev/src/openai/src/lib/streaming/OpenAiStreaming.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 6 additions & 34 deletions
40
JS/edgechains/examples/chat-with-pdf/src/tests/chat-with-pdf.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,8 @@ | ||
import { ChatRouter } from "../routes/chat.js"; // Import the ChatRouter | ||
import { Supabase } from "@arakoodev/vector-db"; // Import Supabase | ||
import { test, expect } from 'vitest' | ||
|
||
jest.mock("@arakoodev/vector-db", () => ({ | ||
Supabase: jest.fn().mockImplementation(() => ({ | ||
createClient: jest.fn().mockReturnValue({ | ||
getDataFromQuery: jest.fn().mockResolvedValue([]), // Mock the getDataFromQuery method | ||
}), | ||
})), | ||
})); | ||
test('should be return expected answer', async () => { | ||
const res = await fetch("http://localhost:3000/chatWithpdf?question=who is Nirmala Sitharaman") | ||
|
||
describe("ChatRouter", () => { | ||
afterEach(() => { | ||
jest.clearAllMocks(); // Clear mock function calls after each test | ||
}); | ||
|
||
test("GET / should return response", async () => { | ||
// Mock request context | ||
const mockCtx = { | ||
req: { | ||
query: jest.fn().mockReturnValue({ question: "test question" }), // Mock query parameter | ||
}, | ||
json: jest.fn(), // Mock json method | ||
}; | ||
|
||
// Execute the route handler | ||
await ChatRouter.get(mockCtx); | ||
|
||
// Assertions | ||
expect(mockCtx.req.query).toHaveBeenCalledWith("question"); // Check if query method was called with the correct parameter | ||
expect(Supabase).toHaveBeenCalled(); // Check if Supabase constructor was called | ||
expect(mockCtx.json).toHaveBeenCalledWith({ res: "mocked response" }); // Check if json method was called with the correct response | ||
}); | ||
|
||
// Add more test cases as needed | ||
}); | ||
const data = await res.json() | ||
expect(data.res).toString() | ||
}, 40000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { configDefaults, defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
exclude: [...configDefaults.exclude, 'packages/template/*'], | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,2 @@ | ||
# standard exclusions | ||
node_modules | ||
|
||
# build artifacts | ||
dist | ||
|
||
# environment files | ||
.env | ||
node_modules |
Oops, something went wrong.