test: add initial unit tests (#56)

* chore: add initial db migration

* test: add unit tests for packages auth, common, widgets

* fix: deep source issues

* fix: format issues

* wip: add unit tests for api routers

* fix: deep source issues

* test:  add missing unit tests for integration router

* wip: board tests

* test: add unit tests for board router

* fix: remove unnecessary null assertions

* fix: deepsource issues

* fix: formatting

* fix: pnpm lock

* fix: lint and typecheck issues

* chore: address pull request feedback

* fix: non-null assertions

* fix: lockfile broken
This commit is contained in:
Meier Lukas
2024-02-10 19:00:08 +01:00
committed by GitHub
parent 13aae82790
commit f070a0cb0a
34 changed files with 3014 additions and 129 deletions

View File

@@ -1,10 +1,26 @@
import { describe, expect, it } from "vitest";
import { objectKeys } from "../object";
import { objectEntries, objectKeys } from "../object";
const testObjects = [
{ a: 1, c: 3, b: 2 },
{ a: 1, b: 2 },
{ a: 1 },
{},
] as const;
describe("objectKeys should return all keys of an object", () => {
it("should return all keys of an object", () => {
const obj = { a: 1, b: 2, c: 3 };
expect(objectKeys(obj)).toEqual(["a", "b", "c"]);
testObjects.forEach((obj) => {
it(`should return all keys of the object ${JSON.stringify(obj)}`, () => {
expect(objectKeys(obj)).toEqual(Object.keys(obj));
});
});
});
describe("objectEntries should return all entries of an object", () => {
testObjects.forEach((obj) => {
it(`should return all entries of the object ${JSON.stringify(obj)}`, () => {
expect(objectEntries(obj)).toEqual(Object.entries(obj));
});
});
});