Skip to content

Commit

Permalink
fix: error code
Browse files Browse the repository at this point in the history
  • Loading branch information
philibea committed Jan 27, 2025
1 parent abe5352 commit c6950e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/use-i18n/src/__tests__/usei18n.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { act, renderHook, waitFor } from '@testing-library/react'
import { enGB, fr as frDateFns } from 'date-fns/locale'
import { ErrorCode, FormatError } from 'intl-messageformat'
import mockdate from 'mockdate'
import type { ComponentProps, ReactNode } from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
Expand Down Expand Up @@ -502,9 +503,12 @@ describe('i18n hook', () => {
)

expect(mockOnTranslateError).toHaveBeenCalledTimes(1)

expect(mockOnTranslateError).toHaveBeenCalledWith({
error: new Error(
error: new FormatError(
'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}"',
ErrorCode.MISSING_VALUE,
'onTranslateError fonction sera appelé car il manque une variable en français {oldFrenchVariable}',
),
defaultLocale: 'en',
currentLocale: 'fr',
Expand Down

0 comments on commit c6950e2

Please sign in to comment.