Skip to content

Commit e2858bd

Browse files
committed
Merge branch 'feat/support-rootparams' into feat/v4-rootparams
2 parents 1c6e61a + 7975883 commit e2858bd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/use-intl/src/core/hasLocale.test.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {it} from 'vitest';
1+
import {expect, it} from 'vitest';
22
import hasLocale from './hasLocale.tsx';
33

44
it('narrows down the type', () => {
@@ -24,3 +24,12 @@ it('can be called with a non-matching narrow candidate', () => {
2424
candidate satisfies never;
2525
}
2626
});
27+
28+
it('can be called with any candidate', () => {
29+
const locales = ['en-US', 'en-GB'] as const;
30+
expect(hasLocale(locales, 'unknown')).toBe(false);
31+
expect(hasLocale(locales, undefined)).toBe(false);
32+
33+
// Relevant since `ParamValue` in Next.js includes `string[]`
34+
expect(hasLocale(locales, ['de'])).toBe(false);
35+
});

0 commit comments

Comments
 (0)