Skip to content

Commit 467364e

Browse files
fix(test/Signer): use vi.hoisted for translation helpers to fix mock hoisting error
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 7e96b2b commit 467364e

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/tests/components/Signers/Signer.spec.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,18 @@ type FilesStoreMock = ReturnType<typeof useFilesStore> & {
3333
isOriginalFileDeleted: MockedFunction<() => boolean>
3434
}
3535

36-
const t: TranslationFunction = (_app, text, vars) => {
37-
if (vars) {
38-
return text.replace(/{(\w+)}/g, (_m, key) => String(vars[key]))
36+
const { t, n } = vi.hoisted(() => {
37+
const t: TranslationFunction = (_app, text, vars) => {
38+
if (vars) {
39+
return text.replace(/{(\w+)}/g, (_m, key) => String(vars[key]))
40+
}
41+
return text
3942
}
40-
return text
41-
}
4243

43-
const n: PluralTranslationFunction = (_app, singular, plural, count) => (count === 1 ? singular : plural)
44+
const n: PluralTranslationFunction = (_app, singular, plural, count) => (count === 1 ? singular : plural)
45+
46+
return { t, n }
47+
})
4448

4549
let Signer: SignerComponent
4650

0 commit comments

Comments
 (0)