diff --git a/cfg/tsconfig.json b/cfg/tsconfig.json index c8e1663..682204f 100644 --- a/cfg/tsconfig.json +++ b/cfg/tsconfig.json @@ -10,7 +10,7 @@ "outDir": "${configDir}/dist", // Target/module - "target": "es2023", + "target": "es2022", // todo: es2023 when all consumers are on ts5.6+ "lib": ["esnext"], // add "dom" if needed // module `nodenext` is a modern mode that auto-detects cjs/esm // it also defaults `esModuleInterop` and `allowSyntheticDefaultImports` to true diff --git a/src/testing/time.util.test.ts b/src/testing/time.util.test.ts index 9e9d1df..4df2889 100644 --- a/src/testing/time.util.test.ts +++ b/src/testing/time.util.test.ts @@ -1,4 +1,4 @@ -import { MOCK_TS_2018_06_21, mockTime, mockTimeMillis, resetTime } from './time.util' +import { MOCK_TS_2018_06_21, mockTime, resetTime } from './time.util' const now = Date.now() @@ -15,10 +15,6 @@ test('mockTime default', () => { expect(Date.now()).toBeGreaterThanOrEqual(now) - mockTimeMillis(123_456) - - expect(Date.now()).toBe(123_456) - resetTime() expect(new Date().getFullYear()).toBeGreaterThan(2018) diff --git a/src/testing/time.util.ts b/src/testing/time.util.ts index fb35cc3..1b2ec0b 100644 --- a/src/testing/time.util.ts +++ b/src/testing/time.util.ts @@ -1,17 +1,14 @@ +import type { UnixTimestamp } from '@naturalcycles/js-lib' import timekeeper from 'timekeeper' -export const MOCK_TS_2018_06_21 = 1_529_539_200 +export const MOCK_TS_2018_06_21 = 1_529_539_200 as UnixTimestamp /** * Locks time-related functions to return always same time. * For deterministic tests. */ export function mockTime(ts = MOCK_TS_2018_06_21): void { - mockTimeMillis(ts * 1000) -} - -export function mockTimeMillis(millis = MOCK_TS_2018_06_21 * 1000): void { - timekeeper.freeze(millis) + timekeeper.freeze(ts * 1000) } export function resetTime(): void { diff --git a/yarn.lock b/yarn.lock index d532079..cfa76a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1014,17 +1014,17 @@ typescript "^5.0.2" "@naturalcycles/js-lib@^14.0.0", "@naturalcycles/js-lib@^14.244.0": - version "14.260.0" - resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.260.0.tgz#1086a684ff4ccd028be053d9fa701d9cd5358dbf" - integrity sha512-GfkmD+xAP8GODx2kh++5MErmDMu50S/QAslbtoaKtpWrmFlfaMEtNpYLXLDYGjcj4NJRilbE9hwiM8Rizs5V2g== + version "14.261.0" + resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.261.0.tgz#e85aaa6c68b5efeada4e4cfdcb5c00e5e30a8d3a" + integrity sha512-7+jI98zjNcifAkQu8q4UHhXzeclJVIDfoE8GHpwdqjbaT6a9p2KOikvBjMd1SdCH1OTR6ijBPNvax1VS9Jb2qw== dependencies: tslib "^2.0.0" zod "^3.20.2" "@naturalcycles/nodejs-lib@^13.0.1": - version "13.36.0" - resolved "https://registry.yarnpkg.com/@naturalcycles/nodejs-lib/-/nodejs-lib-13.36.0.tgz#cea71bd4e88ba37d28cb4af9a12fd5e0678d4fd0" - integrity sha512-v6t2P2HGFhaCFN9iM5Fgvg7qnf7FAK76SatCLGoQtdozyUX7xnPj8xUe35ft2YGvmu1TaWU4UWqRKTJEWGwByA== + version "13.37.1" + resolved "https://registry.yarnpkg.com/@naturalcycles/nodejs-lib/-/nodejs-lib-13.37.1.tgz#c30ace789bf7a484c548bb7d67fd6501dcb6272e" + integrity sha512-Ltw5SAGUkLH4pp+juov16LOwjSCyXdFBEgLXcCbOcQV9a5l9jLZouULrSQ+CpBvpXTElKRAFqWobU57wQHVtgw== dependencies: "@naturalcycles/js-lib" "^14.244.0" "@types/js-yaml" "^4.0.9"