From 03d45f91f26cd4fb97da8f82d89d48b5ff7843ef Mon Sep 17 00:00:00 2001 From: acnormun Date: Fri, 25 Oct 2024 10:32:42 -0300 Subject: [PATCH] fix: wwp config i18n mock --- .../config/channels/whatsapp/Config.spec.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tests/components/config/channels/whatsapp/Config.spec.js b/src/tests/components/config/channels/whatsapp/Config.spec.js index afbb735b..4f56e161 100644 --- a/src/tests/components/config/channels/whatsapp/Config.spec.js +++ b/src/tests/components/config/channels/whatsapp/Config.spec.js @@ -6,6 +6,17 @@ import UnnnicSystem from '@/utils/plugins/UnnnicSystem'; import { setActivePinia } from 'pinia'; import { createTestingPinia } from '@pinia/testing'; +vi.mock('vue-i18n', async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + createI18n: () => ({ + t: (key) => key, + locale: 'pt-br', + }), + }; +}); + describe('WhatsappConfig.vue', () => { let wrapper; const pinia = createTestingPinia({ stubActions: false }); @@ -24,6 +35,9 @@ describe('WhatsappConfig.vue', () => { plugins: [pinia, i18n, UnnnicSystem], mocks: { $t: (msg) => msg, + $i18n: { + locale: 'pt-br', + }, }, }, props: { app }, @@ -46,7 +60,7 @@ describe('WhatsappConfig.vue', () => { const description = wrapper.find('.config-whatsapp__header__description'); expect(description.exists()).toBe(true); expect(description.text()).toContain( - 'Learn more about how to increase your daily message limit in WhatsApp here.', + 'WhatsApp.config.description.text WhatsApp.config.description.link', ); });