11import { describe , it , expect , beforeEach , afterEach , vi } from "vitest" ;
2+ import { setup } from "../../__testData__/controller-test" ;
23import _ from "lodash" ;
34import { ObjectId } from "mongodb" ;
4- import request from "supertest" ;
5- import app from "../../../src/app" ;
65import * as LeaderboardDal from "../../../src/dal/leaderboards" ;
76import * as DailyLeaderboards from "../../../src/utils/daily-leaderboards" ;
87import * as WeeklyXpLeaderboard from "../../../src/services/weekly-xp-leaderboard" ;
98import * as Configuration from "../../../src/init/configuration" ;
10- import {
11- mockAuthenticateWithApeKey ,
12- mockBearerAuthentication ,
13- } from "../../__testData__/auth" ;
9+ import { mockAuthenticateWithApeKey } from "../../__testData__/auth" ;
1410import { XpLeaderboardEntry } from "@monkeytype/schemas/leaderboards" ;
1511
16- const mockApp = request ( app ) ;
12+ const { mockApp, uid } = setup ( ) ;
1713const configuration = Configuration . getCachedConfiguration ( ) ;
18- const uid = new ObjectId ( ) . toHexString ( ) ;
19- const mockAuth = mockBearerAuthentication ( uid ) ;
2014
2115const allModes = [
2216 "10" ,
@@ -32,9 +26,6 @@ const allModes = [
3226] ;
3327
3428describe ( "Loaderboard Controller" , ( ) => {
35- beforeEach ( ( ) => {
36- mockAuth . beforeEach ( ) ;
37- } ) ;
3829 describe ( "get leaderboard" , ( ) => {
3930 const getLeaderboardMock = vi . spyOn ( LeaderboardDal , "get" ) ;
4031 const getLeaderboardCountMock = vi . spyOn ( LeaderboardDal , "getCount" ) ;
0 commit comments