Bug: Add account scoping in CTA (#754)

This commit is contained in:
Pranav Raj S
2020-04-23 12:21:45 +05:30
committed by GitHub
parent 645d53db1c
commit 7d41b7a5dc
4 changed files with 56 additions and 10 deletions

View 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'
);
});
});