parent
7c21cf2255
commit
6bfa551c85
16 changed files with 142 additions and 38 deletions
|
@ -1,6 +1,7 @@
|
|||
export default [
|
||||
{
|
||||
id: 1,
|
||||
trigger_only_during_business_hours: false,
|
||||
trigger_rules: {
|
||||
time_on_page: 3,
|
||||
url: 'https://www.chatwoot.com/pricing',
|
||||
|
@ -8,6 +9,7 @@ export default [
|
|||
},
|
||||
{
|
||||
id: 2,
|
||||
trigger_only_during_business_hours: false,
|
||||
trigger_rules: {
|
||||
time_on_page: 6,
|
||||
url: 'https://www.chatwoot.com/about',
|
|
@ -3,8 +3,12 @@ import {
|
|||
formatCampaigns,
|
||||
filterCampaigns,
|
||||
} from '../campaignHelper';
|
||||
import campaigns from './camapginFixtures';
|
||||
describe('#Campagin Helper', () => {
|
||||
import campaigns from './campaignFixtures';
|
||||
|
||||
global.chatwootWebChannel = {
|
||||
workingHoursEnabled: false,
|
||||
};
|
||||
describe('#Campaigns Helper', () => {
|
||||
describe('stripTrailingSlash', () => {
|
||||
it('should return striped trailing slash if url with trailing slash is passed', () => {
|
||||
expect(
|
||||
|
@ -14,15 +18,17 @@ describe('#Campagin Helper', () => {
|
|||
});
|
||||
|
||||
describe('formatCampaigns', () => {
|
||||
it('should return formated campaigns if camapgins are passed', () => {
|
||||
it('should return formatted campaigns if campaigns are passed', () => {
|
||||
expect(formatCampaigns({ campaigns })).toStrictEqual([
|
||||
{
|
||||
id: 1,
|
||||
timeOnPage: 3,
|
||||
triggerOnlyDuringBusinessHours: false,
|
||||
url: 'https://www.chatwoot.com/pricing',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
triggerOnlyDuringBusinessHours: false,
|
||||
timeOnPage: 6,
|
||||
url: 'https://www.chatwoot.com/about',
|
||||
},
|
||||
|
@ -30,7 +36,7 @@ describe('#Campagin Helper', () => {
|
|||
});
|
||||
});
|
||||
describe('filterCampaigns', () => {
|
||||
it('should return filtered campaigns if formatted camapgins are passed', () => {
|
||||
it('should return filtered campaigns if formatted campaigns are passed', () => {
|
||||
expect(
|
||||
filterCampaigns({
|
||||
campaigns: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue