boring tests

This commit is contained in:
zkldi
2021-04-27 00:44:17 +01:00
parent 1a5f8e09e3
commit e8426ec99b
2 changed files with 39 additions and 0 deletions
+9
View File
@@ -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();
});
+30
View File
@@ -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);