Skip to content

Commit

Permalink
mock date for spec
Browse files Browse the repository at this point in the history
in the time calc there may be subtle drift if our date-fns parsing "copies" certain elements from the runtime clock when they're not defined in our date strings
  • Loading branch information
sterlingwes committed Jan 29, 2024
1 parent 2b3f2c3 commit 74e8185
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"dependencies": {
"d3-node": "^3.0.0",
"date-fns": "^3.3.0",
"mockdate": "^3.0.5",
"point-at-length": "^1.1.0",
"reading-time": "^1.5.0",
"vitest": "^1.2.1"
Expand Down
9 changes: 8 additions & 1 deletion site/src/lib/server/timeline.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { expect, test } from "vitest";
import MockDate from "mockdate";
import { afterAll, beforeAll, expect, test } from "vitest";
import { getTimeline } from "./timeline";
import { getSvgDomain } from "./svg";
import { getEnhancedPosts } from "./posts";
import dataFixture from "./__fixtures__/data.json";

test("timeline datamodel integration", () => {
beforeAll(() => {
MockDate.set(new Date(2023, 12, 31, 23, 0, 0, 0));
});

afterAll(() => MockDate.reset());

const posts = getEnhancedPosts(
require("../../content/enabler/talbroda.json").posts
);
Expand Down

0 comments on commit 74e8185

Please sign in to comment.