mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-29 10:28:04 +03:00
I'm sorry for how disgustingly large all of these commits are. I promise that this is the last time something this disgusting will happen. This is a mono-patch for various things that were broken by the major refactor. It's mostly things like error messages now being different (and tests failing as a result). Some notable fixes include me accidentally deleting the entire DELETE api-tokens endpoint (lol), and timeAchieved: 0 in batch-manual not coercing to null anymore. It appears the behaviour was intentional for some reason. I'm not sure why though.
31 lines
701 B
TypeScript
31 lines
701 B
TypeScript
import { GetScoresFromSession } from "./session";
|
|
import db from "external/mongo/db";
|
|
import t from "tap";
|
|
import ResetDBState from "test-utils/resets";
|
|
|
|
t.test("#GetScoresFromSession", async (t) => {
|
|
t.beforeEach(ResetDBState);
|
|
|
|
await ResetDBState();
|
|
|
|
const exampleSession = await db.sessions.findOne();
|
|
|
|
const scores = await GetScoresFromSession(exampleSession!);
|
|
|
|
t.equal(
|
|
scores.length,
|
|
exampleSession!.scoreInfo.length,
|
|
"Should return the same amount of scores as the session."
|
|
);
|
|
|
|
for (let i = 0; i < exampleSession!.scoreInfo.length; i++) {
|
|
t.equal(
|
|
scores[i]!.scoreID,
|
|
exampleSession!.scoreInfo[i]!.scoreID,
|
|
"Should return the scores requested."
|
|
);
|
|
}
|
|
|
|
t.end();
|
|
});
|