-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a cutoff date from BCD for Baseline high (#1333)
Fixes #1331.
- Loading branch information
Showing
4 changed files
with
55 additions
and
81 deletions.
There are no files selected for viewing
26 changes: 12 additions & 14 deletions
26
packages/compute-baseline/src/baseline/date-utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
import assert from "node:assert/strict"; | ||
|
||
import { Temporal } from "@js-temporal/polyfill"; | ||
import { isFuture } from "./date-utils.js"; | ||
import { toHighDate, toDateString } from "./date-utils.js"; | ||
|
||
describe("isFuture", function () { | ||
it("returns true for tomorrow", function () { | ||
const tomorrow = Temporal.Now.plainDateISO().add({ days: 1 }); | ||
assert(isFuture(tomorrow)); | ||
describe("toHighDate", function () { | ||
it("Jan 1", function () { | ||
assert.equal(toDateString(toHighDate("2020-01-01")), "2022-07-01"); | ||
}); | ||
|
||
it("returns false for yesterday", function () { | ||
const yesterday = Temporal.Now.plainDateISO().subtract({ days: 1 }); | ||
assert(isFuture(yesterday) === false); | ||
it("Feb 28", function () { | ||
assert.equal(toDateString(toHighDate("2020-02-28")), "2022-08-28"); | ||
}); | ||
|
||
it("returns false for today", function () { | ||
const now = Temporal.Now.plainDateISO(); | ||
assert(isFuture(now) === false); | ||
// Last date for a feature to become Baseline high in YYYY+2 instead of +3. | ||
it("Jun 30", function () { | ||
assert.equal(toDateString(toHighDate("2020-06-30")), "2022-12-30"); | ||
}); | ||
it("Dec 31", function () { | ||
assert.equal(toDateString(toHighDate("2020-12-31")), "2023-06-30"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters