Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Aug 14, 2024
1 parent 23d1405 commit d9b725e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/date-time-format/tests/format-to-parts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

import { describe, it, expect } from 'vitest';
import { Intl } from 'temporal-polyfill';

import { formatDateTimeToParts } from '..';

Expand Down
1 change: 1 addition & 0 deletions src/lib/date-time-format/tests/format.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

import { describe, it, expect } from 'vitest';
import { Intl } from 'temporal-polyfill';

import { formatDateTime, formatDate, formatTime } from '..';

Expand Down
1 change: 1 addition & 0 deletions src/lib/date-time-format/tests/resolve-format.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

import { describe, it, expect } from 'vitest';
import { Intl } from 'temporal-polyfill';

import { resolveDateTimeFormat } from '..';

Expand Down
1 change: 1 addition & 0 deletions src/lib/date-time-format/tests/unsupported-styles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

import { vi, describe, it, expect } from 'vitest';
import { Intl } from 'temporal-polyfill';

import { formatDateTime } from '..';

Expand Down
3 changes: 2 additions & 1 deletion vitest.setup.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { vi, expect } from 'vitest';
import * as matchers from 'jest-extended';
import { Intl as IntlWithTemporal } from 'temporal-polyfill';

expect.extend(matchers);

vi.spyOn(Intl, 'NumberFormat');
vi.spyOn(Intl, 'DateTimeFormat');
vi.spyOn(IntlWithTemporal, 'DateTimeFormat');

// Apparently, Node.js doesn't implement these APIs.
// The mocked return value is based on the test value `1001001001.11111`
Expand Down

0 comments on commit d9b725e

Please sign in to comment.