mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-10 16:28:17 +03:00
boring tests
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import t from "tap";
|
||||
import { GetMilisecondsSince } from "./hrtime-core";
|
||||
|
||||
t.test("#GetMilisecondsSince", (t) => {
|
||||
let time = GetMilisecondsSince(10n);
|
||||
t.ok(typeof time === "number" && time > 0, "Should return a number greater than 0.");
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import t from "tap";
|
||||
import db, { CloseMongoConnection } from "../db/db";
|
||||
import ResetDBState from "../test-utils/reset-db-state";
|
||||
import { GetScoresFromSession } from "./session-core";
|
||||
|
||||
t.test("#GetScoresFromSession", async (t) => {
|
||||
t.beforeEach(ResetDBState);
|
||||
|
||||
let exampleSession = await db.sessions.findOne();
|
||||
|
||||
let 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();
|
||||
});
|
||||
|
||||
t.teardown(CloseMongoConnection);
|
||||
Reference in New Issue
Block a user