Skip to content

Commit

Permalink
refactor: use vitest to run test on libs
Browse files Browse the repository at this point in the history
  • Loading branch information
swh00tw committed Mar 11, 2024
1 parent c21ce5d commit 5f49cba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
17 changes: 8 additions & 9 deletions libs/recnet-api-model/src/lib/model.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { dateSchema } from "./model";
import { expect, test } from "vitest";

describe("Timestamp should be coerced and parsed as Date", () => {
it("should work", () => {
const date = new Date();
const dateStr = date.getTime();
const parsed = dateSchema.safeParse(dateStr);
expect(parsed.success).toBe(true);
if (!parsed.success) return;
expect(parsed.data).toBeInstanceOf(Date);
});
test("Timestamp should be coerced and parsed as Date", () => {
const date = new Date();
const dateStr = date.getTime();
const parsed = dateSchema.safeParse(dateStr);
expect(parsed.success).toBe(true);
if (!parsed.success) return;
expect(parsed.data).toBeInstanceOf(Date);
});
7 changes: 3 additions & 4 deletions libs/recnet-date-fns/src/lib/recnet-date-fns.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Months } from "./recnet-date-fns";
import { expect, test } from "vitest";

describe("Should have 12 months", () => {
it("should work", () => {
expect(Months.length).toEqual(12);
});
test("Should have 12 months", () => {
expect(Months.length).toEqual(12);
});

0 comments on commit 5f49cba

Please sign in to comment.