mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
Another step in the direction of improving node tests and using type-correct organic data as much as possible.
29 lines
1012 B
JavaScript
29 lines
1012 B
JavaScript
"use strict";
|
|
|
|
const assert = require("node:assert/strict");
|
|
|
|
const {addDays} = require("date-fns");
|
|
|
|
const {make_realm} = require("./lib/example_realm.cjs");
|
|
const {zrequire} = require("./lib/namespace.cjs");
|
|
const {run_test} = require("./lib/test.cjs");
|
|
|
|
const demo_organization_ui = zrequire("demo_organizations_ui");
|
|
const {set_realm} = zrequire("state_data");
|
|
|
|
const realm = make_realm();
|
|
set_realm(realm);
|
|
|
|
run_test("get_demo_organization_deadline_days_remaining", ({override}) => {
|
|
const start_time = new Date("2024-01-01T10:00:00.000Z"); // Wednesday 1/1/2024 10:00:00 AM (UTC+0)
|
|
override(Date, "now", () => start_time);
|
|
|
|
const demo_organization_scheduled_deletion_date = addDays(start_time, 7); // Wednesday 1/8/2024 10:00:00 AM (UTC+0)
|
|
override(
|
|
realm,
|
|
"demo_organization_scheduled_deletion_date",
|
|
Math.trunc(demo_organization_scheduled_deletion_date / 1000),
|
|
);
|
|
assert.equal(demo_organization_ui.get_demo_organization_deadline_days_remaining(), 7);
|
|
});
|