mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 20:18:08 +00:00
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>
40 lines
1.1 KiB
JavaScript
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,
|
|
});
|
|
});
|
|
});
|
|
});
|