Skip to content

Commit

Permalink
Fix expected localized time format in tests
Browse files Browse the repository at this point in the history
* The U+202F character is now a simple space in Node.js v18.15.0.
  • Loading branch information
canac committed Nov 20, 2024
1 parent 3ae874f commit 9fbc3fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('DateTimeFieldPair', () => {
const { getByRole } = render(<TestComponent />);

expect(getByRole('textbox', { name: 'Date' })).toHaveValue('1/2/2024');
expect(getByRole('textbox', { name: 'Time' })).toHaveValue('3:04\u202fAM');
expect(getByRole('textbox', { name: 'Time' })).toHaveValue('3:04 AM');
});

it('changes the date to today when the date is cleared', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('DesktopTimeField', () => {
it('the formatted value', () => {
const { getByRole } = render(<TestComponent />);

expect(getByRole('textbox')).toHaveValue('3:04\u202fAM');
expect(getByRole('textbox')).toHaveValue('3:04 AM');
});

it('clears when the new value is null', () => {
Expand All @@ -57,14 +57,14 @@ describe('DesktopTimeField', () => {
const { getByRole, rerender } = render(<TestComponent />);
rerender(<TestComponent value={DateTime.invalid('Invalid')} />);

expect(getByRole('textbox')).toHaveValue('3:04\u202fAM');
expect(getByRole('textbox')).toHaveValue('3:04 AM');
});

it('updates to the formatted new value', () => {
const { getByRole, rerender } = render(<TestComponent />);
rerender(<TestComponent value={DateTime.local(2024, 1, 2, 12, 4, 5)} />);

expect(getByRole('textbox')).toHaveValue('12:04\u202fPM');
expect(getByRole('textbox')).toHaveValue('12:04 PM');
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/intlFormat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe('intlFormat', () => {
locale,
);

expect(date.trim()).toBe('Jan 16, 2024, 6:34\u202fPM UTC');
expect(date.trim()).toBe('Jan 16, 2024, 6:34 PM UTC');
});

it('returns null if month is null', () => {
Expand Down

0 comments on commit 9fbc3fd

Please sign in to comment.