Files
chatwoot/app/javascript/widget/helpers/specs/utils.spec.js
Pranav 9de8c27368 feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722)
Due to the pattern `**/specs/*.spec.js` defined in CircleCI, none of the
frontend spec in the folders such as
`specs/<domain-name>/getters.spec.js` were not executed in Circle CI.

This PR fixes the issue, along with the following changes: 
- Use vitest instead of jest
- Remove jest dependancies
- Update tests to work with vitest

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2024-07-10 08:32:16 -07:00

40 lines
1.1 KiB
JavaScript

import { IFrameHelper } from '../utils';
vi.mock('vue', () => ({
config: {
lang: 'el',
},
}));
describe('#IFrameHelper', () => {
describe('#isAValidEvent', () => {
it('returns if the event is valid', () => {
expect(
IFrameHelper.isAValidEvent({
data: 'chatwoot-widget:{"event":"config-set","locale":"fr","position":"left","hideMessageBubble":false,"showPopoutButton":true}',
})
).toEqual(true);
expect(
IFrameHelper.isAValidEvent({
data: '{"event":"config-set","locale":"fr","position":"left","hideMessageBubble":false,"showPopoutButton":true}',
})
).toEqual(false);
});
});
describe('#getMessage', () => {
it('returns parsed message', () => {
expect(
IFrameHelper.getMessage({
data: 'chatwoot-widget:{"event":"config-set","locale":"fr","position":"left","hideMessageBubble":false,"showPopoutButton":true}',
})
).toEqual({
event: 'config-set',
locale: 'fr',
position: 'left',
hideMessageBubble: false,
showPopoutButton: true,
});
});
});
});