Skip to content

Commit

Permalink
🚧 testing woes
Browse files Browse the repository at this point in the history
  • Loading branch information
coyotte508 committed Nov 26, 2023
1 parent 82128f2 commit 7069630
Show file tree
Hide file tree
Showing 8 changed files with 1,302 additions and 290 deletions.
3 changes: 2 additions & 1 deletion apps/api/app/config/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export async function setupForTest() {
}

export async function teardownForTest() {
server.close();
server?.close();
server = undefined;
await mongoose.connection.db.dropDatabase();
await mongoose.connection.close();
}
9 changes: 7 additions & 2 deletions apps/api/app/models/gamenotification.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import mongoose, { Types } from "mongoose";
import { defaultKarma, Game, GameNotification, GamePreferences, maxKarma, User } from "./index";
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { setupForTest, teardownForTest } from "../config/test-utils";

const { ObjectId } = Types;

describe("GameNotification", () => {
beforeAll(async () => {
await setupForTest();
});
afterAll(async () => {
await teardownForTest();
});
const userId = new ObjectId();
const userId2 = new ObjectId();
const userId3 = new ObjectId();
Expand All @@ -13,8 +20,6 @@ describe("GameNotification", () => {
describe("processGameEnded", () => {
describe("karma", () => {
beforeAll(async () => {
await mongoose.connection.db.dropDatabase();

await User.create({ _id: userId, account: { username: "test", email: "[email protected]" } });
await User.create({ _id: userId2, account: { username: "test2", email: "[email protected]" } });
await Game.create({
Expand Down
1 change: 0 additions & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"lodash": "^4.17.13",
"mailgun-js": "^0.20.0",
"mongo-locks": "^2.0.0",
"mongoose": "6.0.3",
"node-cache": "^5.1.0",
"passport-discord": "^0.1.4",
"passport-facebook": "^3.0.0",
Expand Down
3 changes: 0 additions & 3 deletions apps/api/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-svelte": "^2.30.0",
"mongoose": "^6.1.0",
"prettier": "^3.1.0",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.0.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/models/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
"name": "@bgs/models",
"dependencies": {
"@bgs/types": "workspace:*"
},
"peerDependencies": {
"mongoose": "6.0.3"
}
}
184 changes: 0 additions & 184 deletions packages/models/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7069630

Please sign in to comment.