add istanbul for coverage, unit tests for resposne bodies, add coverage here and there

This commit is contained in:
2025-05-31 11:48:00 -07:00
parent c08a15f01f
commit 6d6d6801db
10 changed files with 626 additions and 46 deletions

30
src/lib/test/me.spec.ts Normal file
View File

@ -0,0 +1,30 @@
import { createId } from "$lib/Id";
import { isMe, type Me } from "$lib/me";
import { equal, ok } from "assert";
import { describe, it } from "vitest";
describe("me", () => {
describe("isMe", () => {
const target: Me = {
id: createId(),
role: "test-role",
username: "Ms. User",
};
it("returns true when the target is shaped like a 'Me'", () => {
ok(isMe(target));
});
it("returns false when the target is missing a property", () => {
const { id, role, username } = target;
equal(isMe({ role, username }), false);
equal(isMe({ id, username }), false);
equal(isMe({ id, role }), false);
});
it("returns false when the target has an extra property", () => {
const { id, role, username } = target;
equal(isMe({ id, role, username, extra: "something" }), false);
});
});
});