iachat/app/javascript/dashboard/store/modules/specs/dashboardApps/getters.spec.js
Gabriel Jablonski 7f0748460e
feat: dashboard apps on sidebar (#146)
* feat: dashboard apps on sidebar

* fix: handle dashboard app not found

* chore: minor refactoring
2025-11-19 14:44:18 -03:00

56 lines
1.2 KiB
JavaScript

import { getters } from '../../dashboardApps';
describe('#getters', () => {
it('getRecords', () => {
const state = {
records: [
{
title: '1',
content: [{ link: 'https://google.com', type: 'frame' }],
},
],
};
expect(getters.getRecords(state)).toEqual(state.records);
});
it('getUIFlags', () => {
const state = {
uiFlags: {
isFetching: true,
isCreating: false,
isDeleting: false,
},
};
expect(getters.getUIFlags(state)).toEqual({
isFetching: true,
isCreating: false,
isDeleting: false,
});
});
it('getAppsOnSidebar', () => {
const state = {
records: [
{
id: 1,
title: 'Zebra App',
show_on_sidebar: true,
},
{
id: 2,
title: 'Alpha App',
show_on_sidebar: true,
},
{
id: 3,
title: 'Beta App',
show_on_sidebar: false,
},
],
};
const result = getters.getAppsOnSidebar(state);
expect(result).toHaveLength(2);
expect(result[0].title).toEqual('Alpha App');
expect(result[1].title).toEqual('Zebra App');
});
});