mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
Bug: Add account scoping in CTA (#754)
This commit is contained in:
35
app/javascript/dashboard/mixins/specs/account.spec.js
Normal file
35
app/javascript/dashboard/mixins/specs/account.spec.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { createWrapper } from '@vue/test-utils';
|
||||
import accountMixin from '../account';
|
||||
import Vue from 'vue';
|
||||
|
||||
jest.mock('../../api/auth', () => ({
|
||||
getCurrentUser: () => ({ account_id: 1 }),
|
||||
}));
|
||||
|
||||
describe('accountMixin', () => {
|
||||
test('set accountId properly', () => {
|
||||
const Component = {
|
||||
render() {},
|
||||
title: 'TestComponent',
|
||||
mixins: [accountMixin],
|
||||
};
|
||||
const Constructor = Vue.extend(Component);
|
||||
const vm = new Constructor().$mount();
|
||||
const wrapper = createWrapper(vm);
|
||||
expect(wrapper.vm.accountId).toBe(1);
|
||||
});
|
||||
|
||||
test('returns current url', () => {
|
||||
const Component = {
|
||||
render() {},
|
||||
title: 'TestComponent',
|
||||
mixins: [accountMixin],
|
||||
};
|
||||
const Constructor = Vue.extend(Component);
|
||||
const vm = new Constructor().$mount();
|
||||
const wrapper = createWrapper(vm);
|
||||
expect(wrapper.vm.addAccountScoping('settings/inboxes/new')).toBe(
|
||||
'/app/accounts/1/settings/inboxes/new'
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user