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,26 @@
|
||||
import { getCurrentInstance } from 'vue';
|
||||
import { emitter } from 'shared/helpers/mitt';
|
||||
import analyticsHelper from 'dashboard/helper/AnalyticsHelper';
|
||||
import { useTrack, useAlert } from '../index';
|
||||
|
||||
vi.mock('vue', () => ({
|
||||
getCurrentInstance: vi.fn(),
|
||||
}));
|
||||
vi.mock('shared/helpers/mitt', () => ({
|
||||
emitter: {
|
||||
emit: vi.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('dashboard/helper/AnalyticsHelper/index', async importOriginal => {
|
||||
const actual = await importOriginal();
|
||||
actual.default = {
|
||||
track: vi.fn(),
|
||||
};
|
||||
return actual;
|
||||
});
|
||||
|
||||
describe('useTrack', () => {
|
||||
it('should return a function', () => {
|
||||
const track = useTrack();
|
||||
expect(typeof track).toBe('function');
|
||||
it('should call analyticsHelper.track and return a function', () => {
|
||||
const eventArgs = ['event-name', { some: 'data' }];
|
||||
useTrack(...eventArgs);
|
||||
expect(analyticsHelper.track).toHaveBeenCalledWith(...eventArgs);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user