Skip to content

Commit

Permalink
fix: mongo in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
hhow09 committed Jan 22, 2025
1 parent c96d6cf commit f93acc0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ jobs:
image: mongo:6.0.20
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.runCommand(\"ping\")'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
MONGODB_URI: mongodb://mongo:27017
MONGODB_URI: mongodb://localhost:27017
strategy:
matrix:
directory: [ "./backend" ]
Expand Down
5 changes: 5 additions & 0 deletions backend/src/repositories/chat-repo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ describe("ChatRepo", () => {
const clientId = "123";
const clientId2 = "456";

jest.setTimeout(30000);

beforeAll(async () => {
const uri: string = process.env.MONGODB_URI || "mongodb://localhost:27017";
client = new MongoClient(uri);
console.log("client", client);
await client.connect();
console.log("client connected");
testCollection = client.db("test").collection<ChatSession>("chat-sessions");
console.log("testCollection", testCollection);
repo = new ChatRepo(testCollection);
});

Expand Down

0 comments on commit f93acc0

Please sign in to comment.