Skip to content

Commit 01ed932

Browse files
authored
test: update to vitest3 (@fehmer) (monkeytypegame#6811)
- **test: use mongodb testcontainer (@fehmer)** - **don't run integration tests in parallel** - **fix premium test** - **refactor, cleanup** - **refactor, cleanup** - **test: add integration tests for daily leaderboards (@fehmer)** - **trigger** - **trigger** - **test: update to vitest3 (@fehmer)**
1 parent f759b0c commit 01ed932

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+653
-901
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ backend/__migration__
33
docker
44
backend/scripts
55
backend/private
6-
**/vitest.config.js
6+
**/vitest.config.ts

backend/__tests__/__integration__/__migration__/testActivity.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import * as UserTestData from "../../__testData__/users";
33
import * as UserDal from "../../../src/dal/user";
44
import * as ResultDal from "../../../src/dal/result";
55
import { DBResult } from "../../../src/utils/result";
6-
import { describeIntegration } from "..";
76

8-
describeIntegration()("testActivity migration", () => {
7+
describe("testActivity migration", () => {
98
it("migrates users without results", async () => {
109
//given
1110
const user1 = await UserTestData.createUser();

backend/__tests__/__integration__/dal/admin-uids.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { ObjectId } from "mongodb";
22
import * as AdminUidsDal from "../../../src/dal/admin-uids";
3-
import { describeIntegration } from "..";
43

5-
describeIntegration()("AdminUidsDal", () => {
4+
describe("AdminUidsDal", () => {
65
describe("isAdmin", () => {
76
it("should return true for existing admin user", async () => {
87
//GIVEN

backend/__tests__/__integration__/dal/ape-keys.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { ObjectId } from "mongodb";
22
import { addApeKey } from "../../../src/dal/ape-keys";
3-
import { describeIntegration } from "..";
43

5-
describeIntegration()("ApeKeysDal", () => {
4+
describe("ApeKeysDal", () => {
65
it("should be able to add a new ape key", async () => {
76
const apeKey = {
87
_id: new ObjectId(),

backend/__tests__/__integration__/dal/blocklist.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { ObjectId } from "mongodb";
22
import * as BlacklistDal from "../../../src/dal/blocklist";
3-
import { describeIntegration } from "..";
43

5-
describeIntegration()("BlocklistDal", () => {
4+
describe("BlocklistDal", () => {
65
describe("add", () => {
76
beforeEach(() => {
87
vitest.useFakeTimers();

backend/__tests__/__integration__/dal/leaderboards.spec.ts renamed to backend/__tests__/__integration__/dal/leaderboards.isolated.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import type { PersonalBest } from "@monkeytype/schemas/shared";
88

99
import * as DB from "../../../src/init/db";
1010
import { LbPersonalBests } from "../../../src/utils/pb";
11-
import { describeIntegration } from "..";
11+
1212
import { pb } from "../../__testData__/users";
1313

14-
describeIntegration()("LeaderboardsDal", () => {
14+
describe("LeaderboardsDal", () => {
1515
afterEach(async () => {
1616
await DB.collection("users").deleteMany({});
1717
});

backend/__tests__/__integration__/dal/preset.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { ObjectId } from "mongodb";
22
import * as PresetDal from "../../../src/dal/preset";
33
import _ from "lodash";
4-
import { describeIntegration } from "..";
54

6-
describeIntegration()("PresetDal", () => {
5+
describe("PresetDal", () => {
76
describe("readPreset", () => {
87
it("should read", async () => {
98
//GIVEN

backend/__tests__/__integration__/dal/public.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { describeIntegration } from "..";
21
import * as PublicDAL from "../../../src/dal/public";
32

4-
describeIntegration()("PublicDAL", function () {
3+
describe("PublicDAL", function () {
54
it("should be able to update stats", async function () {
65
// checks it doesn't throw an error. the actual values are checked in another test.
76
await PublicDAL.updateStats(1, 15);

backend/__tests__/__integration__/dal/result.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as ResultDal from "../../../src/dal/result";
22
import { ObjectId } from "mongodb";
33
import * as UserDal from "../../../src/dal/user";
44
import { DBResult } from "../../../src/utils/result";
5-
import { describeIntegration } from "..";
65

76
let uid: string;
87
const timestamp = Date.now() - 60000;
@@ -63,7 +62,7 @@ async function createDummyData(
6362
});
6463
}
6564
}
66-
describeIntegration()("ResultDal", () => {
65+
describe("ResultDal", () => {
6766
beforeEach(() => {
6867
uid = new ObjectId().toHexString();
6968
});

backend/__tests__/__integration__/dal/user.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { ObjectId } from "mongodb";
55
import { MonkeyMail, ResultFilters } from "@monkeytype/schemas/users";
66
import { PersonalBest, PersonalBests } from "@monkeytype/schemas/shared";
77
import { CustomThemeColors } from "@monkeytype/schemas/configs";
8-
import { describeIntegration } from "..";
98

109
const mockPersonalBest: PersonalBest = {
1110
acc: 1,
@@ -86,7 +85,7 @@ const mockResultFilter: ResultFilters = {
8685

8786
const mockDbResultFilter = { ...mockResultFilter, _id: new ObjectId() };
8887

89-
describeIntegration().sequential("UserDal", () => {
88+
describe("UserDal", () => {
9089
it("should be able to insert users", async () => {
9190
// given
9291
const uid = new ObjectId().toHexString();

0 commit comments

Comments
 (0)