mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
feat: One off campaign UI (#2621)
This commit is contained in:
49
app/javascript/shared/mixins/specs/campaignMixin.spec.js
Normal file
49
app/javascript/shared/mixins/specs/campaignMixin.spec.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import campaignMixin from '../campaignMixin';
|
||||
import inboxMixin from '../inboxMixin';
|
||||
|
||||
describe('campaignMixin', () => {
|
||||
it('returns the correct campaign type', () => {
|
||||
const Component = {
|
||||
render() {},
|
||||
mixins: [campaignMixin, inboxMixin],
|
||||
data() {
|
||||
return {
|
||||
inbox: {
|
||||
channel_type: 'Channel::TwilioSms',
|
||||
phone_number: '+91944444444',
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
const wrapper = shallowMount(Component);
|
||||
expect(wrapper.vm.campaignType).toBe('one_off');
|
||||
});
|
||||
it('isOnOffType returns true if campaign type is ongoing', () => {
|
||||
const Component = {
|
||||
render() {},
|
||||
mixins: [campaignMixin, inboxMixin],
|
||||
data() {
|
||||
return { inbox: { channel_type: 'Channel::WebWidget' } };
|
||||
},
|
||||
};
|
||||
const wrapper = shallowMount(Component);
|
||||
expect(wrapper.vm.isOngoingType).toBe(true);
|
||||
});
|
||||
it('isOngoingType returns true if campaign type is one_off', () => {
|
||||
const Component = {
|
||||
render() {},
|
||||
mixins: [campaignMixin, inboxMixin],
|
||||
data() {
|
||||
return {
|
||||
inbox: {
|
||||
channel_type: 'Channel::TwilioSms',
|
||||
phone_number: '+91944444444',
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
const wrapper = shallowMount(Component);
|
||||
expect(wrapper.vm.isOnOffType).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user