Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MomTV Run Submission #1085

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1154641
feat(shared): numeric type aliases
tsa96 Nov 22, 2024
760214a
feat(formats): new replay format
tsa96 Nov 22, 2024
2434747
refactor(back): use momtv replays in run submission
tsa96 Dec 15, 2024
f26b994
refactor(back): make /maps/:mapID/leaderboard return all leaderboard …
tsa96 Dec 15, 2024
8ecca24
refactor(back): filter HTTP log spew in dev
tsa96 Dec 15, 2024
9c4ef86
refactor(shared): MakeOptional modifier in model validation
tsa96 Dec 15, 2024
80b315f
fix(front): map-leaderboards component using wrong trackNum offset
tsa96 Dec 15, 2024
395691e
chore(db): reword prisma schema comments identifying typescript models
tsa96 Dec 15, 2024
9fd1d81
build(back): enable backend sourcemaps
tsa96 Dec 15, 2024
d936721
feat(utils): magic/ident generator fn
tsa96 Nov 22, 2024
4e992cd
feat(utils): approxEq fn
tsa96 Nov 22, 2024
62499d8
feat(utils): add pick fn, improve omit
tsa96 Dec 15, 2024
ba757b5
feat(utils): sleep fn
tsa96 Dec 15, 2024
041f10b
refactor(back): renaming Tickrates to TickIntervals, fround 32bit FP …
tsa96 Dec 20, 2024
77f145d
refactor(back): add detailed logging to RunProcessor
tsa96 Jan 5, 2025
5f4520f
fix(back): remove duplicate 'HTTP' context in pino logs
tsa96 Jan 5, 2025
b153cdc
fix(back): allow 1000ms system clock desync in run validation
tsa96 Jan 5, 2025
c15b5d7
feat(back): send run rejections to Sentry
tsa96 Jan 5, 2025
e8abfb9
refactor(back): remove deprecated Sentry enableTracing option
tsa96 Jan 5, 2025
03fc68a
refactor(back): increase Sentry normalizeDepth to 6
tsa96 Jan 5, 2025
53f330b
tmp(back): experimental fix for lack of backend crash logs
tsa96 Jan 8, 2025
9e368cc
tmp(back): v8 exit traces/reports
tsa96 Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions apps/backend-e2e/src/maps-2.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
MapImageDto,
MapInfoDto,
MapReviewDto,
MinimalLeaderboardRunDto,
UserDto
} from '../../backend/src/app/dto';
import { readFileSync } from 'node:fs';
Expand Down Expand Up @@ -1230,11 +1229,15 @@ describe('Maps Part 2', () => {
url: `maps/${map.id}/leaderboard`,
status: 200,
query: { gamemode: Gamemode.AHOP },
validatePaged: { type: MinimalLeaderboardRunDto, count: 3 },
validatePaged: { type: LeaderboardRunDto, count: 3 },
token
});

for (const item of res.body.data) expect(item).toHaveProperty('user');
for (const item of res.body.data) {
expect(item).toHaveProperty('user');
expect(item).toHaveProperty('downloadURL');
expect(item).not.toHaveProperty('splits');
}
});

it("should return a list of a leaderboard's runs for a non-default trackType/Num", () =>
Expand All @@ -1246,7 +1249,7 @@ describe('Maps Part 2', () => {
trackType: TrackType.STAGE,
trackNum: 1
},
validatePaged: { type: MinimalLeaderboardRunDto, count: 1 },
validatePaged: { type: LeaderboardRunDto, count: 1 },
token
}));

Expand All @@ -1261,14 +1264,14 @@ describe('Maps Part 2', () => {
req.sortByDateTest({
url: `maps/${map.id}/leaderboard`,
query: { gamemode: Gamemode.AHOP, orderByDate: true },
validate: MinimalLeaderboardRunDto,
validate: LeaderboardRunDto,
token
}));

it('should be ordered by rank by default', () =>
req.sortTest({
url: `maps/${map.id}/leaderboard`,
validate: MinimalLeaderboardRunDto,
validate: LeaderboardRunDto,
query: { gamemode: Gamemode.AHOP },
sortFn: (a, b) => a.time - b.time,
token
Expand All @@ -1278,15 +1281,15 @@ describe('Maps Part 2', () => {
req.skipTest({
url: `maps/${map.id}/leaderboard`,
query: { gamemode: Gamemode.AHOP },
validate: MinimalLeaderboardRunDto,
validate: LeaderboardRunDto,
token
}));

it('should respond with filtered map data using the take parameter', () =>
req.takeTest({
url: `maps/${map.id}/leaderboard`,
query: { gamemode: Gamemode.AHOP },
validate: MinimalLeaderboardRunDto,
validate: LeaderboardRunDto,
token
}));

Expand All @@ -1297,7 +1300,7 @@ describe('Maps Part 2', () => {
gamemode: Gamemode.AHOP,
userIDs: `${u1.id},${u3.id}`
},
validatePaged: { type: MinimalLeaderboardRunDto, count: 2 },
validatePaged: { type: LeaderboardRunDto, count: 2 },
token
});

Expand All @@ -1312,14 +1315,25 @@ describe('Maps Part 2', () => {
gamemode: Gamemode.AHOP,
steamIDs: `${u1.steamID},${u3.steamID}`
},
validatePaged: { type: MinimalLeaderboardRunDto, count: 2 },
validatePaged: { type: LeaderboardRunDto, count: 2 },
token
});

expect(res.body.data[0].userID).toBe(u1.id);
expect(res.body.data[1].userID).toBe(u3.id);
});

it('should respond with expanded map data using the splits expand parameter', () =>
req.expandTest({
url: `maps/${map.id}/leaderboard`,
query: { gamemode: Gamemode.AHOP },
expand: 'splits',
validate: LeaderboardRunDto,
paged: true,
some: true,
token
}));

// Test that permissions checks are getting called
// Yes, u1 has runs on the map, but we don't actually test for that
it('should 403 if the user does not have permission to access to the map', async () => {
Expand Down Expand Up @@ -1372,14 +1386,14 @@ describe('Maps Part 2', () => {
query: { gamemode: Gamemode.AHOP, filter: 'around', take: 8 },
status: 200,
token: u7Token,
validatePaged: { type: MinimalLeaderboardRunDto, returnCount: 9 }
validatePaged: { type: LeaderboardRunDto, returnCount: 9 }
});

// We're calling as user 7, taking 4 on each side, so we expect ranks
// 3, 4, 5, 6, our rank, 8, 9, 10, 11
let rankIndex = 3;
for (const rank of res.body.data) {
expect(rank).toBeValidDto(MinimalLeaderboardRunDto);
expect(rank).toBeValidDto(LeaderboardRunDto);
expect(rank.rank).toBe(rankIndex);
rankIndex++;
}
Expand All @@ -1398,7 +1412,7 @@ describe('Maps Part 2', () => {
},
status: 200,
token: u7Token,
validatePaged: { type: MinimalLeaderboardRunDto, count: 1 }
validatePaged: { type: LeaderboardRunDto, count: 1 }
});

expect(res.body.data[0].userID).toBe(u7.id);
Expand Down Expand Up @@ -1458,7 +1472,7 @@ describe('Maps Part 2', () => {
query: { gamemode: Gamemode.AHOP, filter: 'friends' },
status: 200,
token,
validatePaged: { type: MinimalLeaderboardRunDto, count: 10 }
validatePaged: { type: LeaderboardRunDto, count: 10 }
});

for (const run of res.body.data)
Expand Down
14 changes: 7 additions & 7 deletions apps/backend-e2e/src/maps.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ describe('Maps', () => {
trackType: TrackType.MAIN,
trackNum: 1,
style: 0,
runs: { create: { userID: u1.id, rank: 1, time: 1, stats: {} } }
runs: { create: { userID: u1.id, rank: 1, time: 1, splits: {} } }
}
});

Expand All @@ -630,7 +630,7 @@ describe('Maps', () => {
trackType: TrackType.MAIN,
trackNum: 1,
style: 0,
runs: { create: { userID: u1.id, rank: 1, time: 1, stats: {} } }
runs: { create: { userID: u1.id, rank: 1, time: 1, splits: {} } }
}
});

Expand Down Expand Up @@ -668,7 +668,7 @@ describe('Maps', () => {
trackType: TrackType.MAIN,
trackNum: 1,
style: 0,
runs: { create: { userID: u1.id, rank: 1, time: 1, stats: {} } }
runs: { create: { userID: u1.id, rank: 1, time: 1, splits: {} } }
}
});

Expand All @@ -680,7 +680,7 @@ describe('Maps', () => {
trackType: TrackType.MAIN,
trackNum: 1,
style: 0,
runs: { create: { userID: u1.id, rank: 1, time: 1, stats: {} } }
runs: { create: { userID: u1.id, rank: 1, time: 1, splits: {} } }
}
});

Expand Down Expand Up @@ -2356,7 +2356,7 @@ describe('Maps', () => {
create: {
userID: u1.id,
time: 1,
stats: {},
splits: {},
rank: 1
}
}
Expand Down Expand Up @@ -2399,7 +2399,7 @@ describe('Maps', () => {
create: {
userID: u1.id,
time: 1,
stats: {},
splits: {},
rank: 1
}
}
Expand Down Expand Up @@ -2480,7 +2480,7 @@ describe('Maps', () => {
create: {
userID: u1.id,
time: 1,
stats: {},
splits: {},
rank: 1
}
}
Expand Down
Loading
Loading