Skip to content

Commit c6950e2

Browse files
committed
fix: error code
1 parent abe5352 commit c6950e2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/use-i18n/src/__tests__/usei18n.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { act, renderHook, waitFor } from '@testing-library/react'
22
import { enGB, fr as frDateFns } from 'date-fns/locale'
3+
import { ErrorCode, FormatError } from 'intl-messageformat'
34
import mockdate from 'mockdate'
45
import type { ComponentProps, ReactNode } from 'react'
56
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -502,9 +503,12 @@ describe('i18n hook', () => {
502503
)
503504

504505
expect(mockOnTranslateError).toHaveBeenCalledTimes(1)
506+
505507
expect(mockOnTranslateError).toHaveBeenCalledWith({
506-
error: new Error(
508+
error: new FormatError(
507509
'The intl string context variable "oldFrenchVariable" was not provided to the string "onTranslateError fonction sera appelé car il manque une variable en français {oldFrenchVariable}"',
510+
ErrorCode.MISSING_VALUE,
511+
'onTranslateError fonction sera appelé car il manque une variable en français {oldFrenchVariable}',
508512
),
509513
defaultLocale: 'en',
510514
currentLocale: 'fr',

0 commit comments

Comments
 (0)