mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	* feat: Autogenerate push notification keys * add vapid service class and remove pushkey model * add spec for vapid service * unset vapid env keys * Unset VAPID_PRIVATE_KEY env variable Co-authored-by: Sojan Jose <sojan@chatwoot.com> Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com>
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import { shallowMount } from '@vue/test-utils';
 | 
						|
import campaignMixin from '../campaignMixin';
 | 
						|
 | 
						|
describe('campaignMixin', () => {
 | 
						|
  beforeEach(() => {
 | 
						|
    global.window = Object.create(window);
 | 
						|
  });
 | 
						|
  it('returns the correct campaign type', () => {
 | 
						|
    const url = 'http://localhost:3000/app/accounts/1/campaigns/one_off';
 | 
						|
    Object.defineProperty(window, 'location', {
 | 
						|
      value: {
 | 
						|
        href: url,
 | 
						|
      },
 | 
						|
    });
 | 
						|
    window.location.href = url;
 | 
						|
    const Component = {
 | 
						|
      render() {},
 | 
						|
      mixins: [campaignMixin],
 | 
						|
    };
 | 
						|
    const wrapper = shallowMount(Component);
 | 
						|
    expect(wrapper.vm.campaignType).toBe('one_off');
 | 
						|
  });
 | 
						|
  it('isOnOffType returns true if campaign type is one_off', () => {
 | 
						|
    const url = 'http://localhost:3000/app/accounts/1/campaigns/one_off';
 | 
						|
    Object.defineProperty(window, 'location', {
 | 
						|
      value: {
 | 
						|
        href: url,
 | 
						|
      },
 | 
						|
    });
 | 
						|
    const Component = {
 | 
						|
      render() {},
 | 
						|
      mixins: [campaignMixin],
 | 
						|
    };
 | 
						|
    const wrapper = shallowMount(Component);
 | 
						|
    expect(wrapper.vm.isOnOffType).toBe(true);
 | 
						|
  });
 | 
						|
});
 |