chore: fix circleci on vite build (#10214)
- Switch to pnpm based build - Switch circleci from docker to machine to have more memory - Fix frontend and backend tests Fixes https://linear.app/chatwoot/issue/CW-3610/fix-circle-ci-for-vite-build --------- Co-authored-by: Shivam Mishra <scm.mymail@gmail.com> Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
@@ -1,20 +1,14 @@
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import TemplateParser from '../../../../dashboard/components/widgets/conversation/WhatsappTemplates/TemplateParser.vue';
|
||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
||||
import { templates } from './fixtures';
|
||||
const localVue = createLocalVue();
|
||||
import VueI18n from 'vue-i18n';
|
||||
import i18n from 'dashboard/i18n';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
localVue.use(VueI18n);
|
||||
|
||||
const i18nConfig = new VueI18n({ locale: 'en', messages: i18n });
|
||||
const config = {
|
||||
localVue,
|
||||
i18n: i18nConfig,
|
||||
stubs: {
|
||||
WootButton: { template: '<button />' },
|
||||
WootInput: { template: '<input />' },
|
||||
global: {
|
||||
stubs: {
|
||||
WootButton: { template: '<button />' },
|
||||
WootInput: { template: '<input />' },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -22,7 +16,7 @@ describe('#WhatsAppTemplates', () => {
|
||||
it('returns all variables from a template string', async () => {
|
||||
const wrapper = shallowMount(TemplateParser, {
|
||||
...config,
|
||||
propsData: { template: templates[0] },
|
||||
props: { template: templates[0] },
|
||||
});
|
||||
await nextTick();
|
||||
expect(wrapper.vm.variables).toEqual(['{{1}}', '{{2}}', '{{3}}']);
|
||||
@@ -31,7 +25,7 @@ describe('#WhatsAppTemplates', () => {
|
||||
it('returns no variables from a template string if it does not contain variables', async () => {
|
||||
const wrapper = shallowMount(TemplateParser, {
|
||||
...config,
|
||||
propsData: { template: templates[12] },
|
||||
props: { template: templates[12] },
|
||||
});
|
||||
await nextTick();
|
||||
expect(wrapper.vm.variables).toBeNull();
|
||||
@@ -40,7 +34,7 @@ describe('#WhatsAppTemplates', () => {
|
||||
it('returns the body of a template', async () => {
|
||||
const wrapper = shallowMount(TemplateParser, {
|
||||
...config,
|
||||
propsData: { template: templates[1] },
|
||||
props: { template: templates[1] },
|
||||
});
|
||||
await nextTick();
|
||||
const expectedOutput =
|
||||
@@ -51,13 +45,15 @@ describe('#WhatsAppTemplates', () => {
|
||||
it('generates the templates from variable input', async () => {
|
||||
const wrapper = shallowMount(TemplateParser, {
|
||||
...config,
|
||||
propsData: { template: templates[0] },
|
||||
});
|
||||
await nextTick();
|
||||
await wrapper.setData({
|
||||
processedParams: { 1: 'abc', 2: 'xyz', 3: 'qwerty' },
|
||||
props: { template: templates[0] },
|
||||
});
|
||||
await nextTick();
|
||||
|
||||
// Instead of using `setData`, directly modify the `processedParams` using the component's logic
|
||||
await wrapper.vm.$nextTick();
|
||||
wrapper.vm.processedParams = { 1: 'abc', 2: 'xyz', 3: 'qwerty' };
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
const expectedOutput =
|
||||
'Esta é a sua confirmação de voo para abc-xyz em qwerty.';
|
||||
expect(wrapper.vm.processedString).toEqual(expectedOutput);
|
||||
|
||||
Reference in New Issue
Block a user