Skip to content

Commit

Permalink
clear currentDate in after
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Nov 22, 2024
1 parent 8bf9182 commit 679ed0a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions test/build-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const failureTests = ["missing-file", "missing-import"];

describe("build", () => {
before(() => setCurrentDate(new Date("2024-01-10T16:00:00")));
after(() => setCurrentDate(null));
mockJsDelivr();
mockJsr();
mockDuckDB();
Expand Down
1 change: 1 addition & 0 deletions test/config-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const DUCKDB_DEFAULTS: DuckDBConfig = {

describe("readConfig(undefined, root)", () => {
before(() => setCurrentDate(new Date("2024-01-10T16:00:00")));
after(() => setCurrentDate(null));
it("imports the config file at the specified root", async () => {
const {md, loaders, paths, normalizePath, ...config} = await readConfig(undefined, "test/input/build/config");
assert(md instanceof MarkdownIt);
Expand Down
1 change: 1 addition & 0 deletions test/deploy-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ const DEPLOY_CONFIG: DeployConfig & {projectId: string; projectSlug: string; wor

describe("deploy", () => {
before(() => setCurrentDate(new Date("2024-01-10T16:00:00")));
after(() => setCurrentDate(null));
mockObservableApi();
mockJsDelivr();

Expand Down
5 changes: 0 additions & 5 deletions test/loader-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {mkdir, readFile, rm, stat, unlink, utimes, writeFile} from "node:fs/prom
import os from "node:os";
import {join} from "node:path/posix";
import {sort} from "d3-array";
import {setCurrentDate} from "../src/config.js";
import {clearFileInfo} from "../src/javascript/module.js";
import type {LoadEffects} from "../src/loader.js";
import {LoaderResolver} from "../src/loader.js";
Expand Down Expand Up @@ -119,8 +118,6 @@ describe("LoaderResolver.find(path)", () => {

describe("LoaderResolver.getSourceFileHash(path)", () => {
const time = new Date(Date.UTC(2023, 11, 1));
before(() => setCurrentDate(null));
after(() => setCurrentDate(new Date("2024-01-10T16:00:00")));
it("returns the content hash for the specified file’s data loader", async () => {
await utimes("test/input/build/archives.posix/dynamic.zip.sh", time, time);
await utimes("test/input/build/archives.posix/static.zip", time, time);
Expand All @@ -143,8 +140,6 @@ describe("LoaderResolver.get{Source,Output}Info(path)", () => {
const time1 = new Date(Date.UTC(2023, 11, 1));
const time2 = new Date(Date.UTC(2024, 2, 1));
const loaders = new LoaderResolver({root: "test"});
before(() => setCurrentDate(null));
after(() => setCurrentDate(new Date("2024-01-10T16:00:00")));
it("both return the last modification time for a simple file", async () => {
await utimes("test/input/loader/simple.txt", time1, time1);
assert.deepStrictEqual(loaders.getSourceInfo("input/loader/simple.txt"), {hash: "3b09aeb6f5f5336beb205d7f720371bc927cd46c21922e334d47ba264acb5ba4", mtimeMs: +time1, size: 6}); // prettier-ignore
Expand Down

0 comments on commit 679ed0a

Please sign in to comment.