mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
- Switch to pnpm based build - Switch circleci from docker to machine to have more memory - Fix frontend and backend tests Fixes https://linear.app/chatwoot/issue/CW-3610/fix-circle-ci-for-vite-build --------- Co-authored-by: Shivam Mishra <scm.mymail@gmail.com> Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Pranav <pranav@chatwoot.com>
89 lines
1.9 KiB
JavaScript
89 lines
1.9 KiB
JavaScript
import { shallowMount } from '@vue/test-utils';
|
|
import { createStore } from 'vuex';
|
|
import FluentIcon from 'shared/components/FluentIcon/DashboardIcon.vue';
|
|
import NotificationBell from '../NotificationBell.vue';
|
|
|
|
const $route = {
|
|
name: 'notifications_index',
|
|
};
|
|
|
|
describe('notificationBell', () => {
|
|
const accountId = 1;
|
|
const notificationMetadata = { unreadCount: 19 };
|
|
let store = null;
|
|
let actions = null;
|
|
let modules = null;
|
|
|
|
beforeEach(() => {
|
|
actions = {
|
|
showNotification: vi.fn(),
|
|
};
|
|
modules = {
|
|
auth: {
|
|
namespaced: false,
|
|
getters: {
|
|
getCurrentAccountId: () => accountId,
|
|
},
|
|
},
|
|
notifications: {
|
|
namespaced: false,
|
|
getters: {
|
|
'notifications/getMeta': () => notificationMetadata,
|
|
},
|
|
},
|
|
};
|
|
|
|
store = createStore({
|
|
actions,
|
|
modules,
|
|
});
|
|
});
|
|
|
|
it('it should return unread count 19', () => {
|
|
const wrapper = shallowMount(NotificationBell, {
|
|
global: {
|
|
plugins: [store],
|
|
mocks: {
|
|
$route,
|
|
},
|
|
components: {
|
|
'fluent-icon': FluentIcon,
|
|
},
|
|
},
|
|
});
|
|
expect(wrapper.vm.unreadCount).toBe('19');
|
|
});
|
|
|
|
it('it should return unread count 99+', async () => {
|
|
notificationMetadata.unreadCount = 100;
|
|
const wrapper = shallowMount(NotificationBell, {
|
|
global: {
|
|
plugins: [store],
|
|
mocks: {
|
|
$route,
|
|
},
|
|
components: {
|
|
'fluent-icon': FluentIcon,
|
|
},
|
|
},
|
|
});
|
|
expect(wrapper.vm.unreadCount).toBe('99+');
|
|
});
|
|
|
|
it('isNotificationPanelActive', async () => {
|
|
const notificationBell = shallowMount(NotificationBell, {
|
|
global: {
|
|
plugins: [store],
|
|
mocks: {
|
|
$route,
|
|
},
|
|
components: {
|
|
'fluent-icon': FluentIcon,
|
|
},
|
|
},
|
|
});
|
|
|
|
expect(notificationBell.vm.isNotificationPanelActive).toBe(true);
|
|
});
|
|
});
|