mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
Due to the pattern `**/specs/*.spec.js` defined in CircleCI, none of the frontend spec in the folders such as `specs/<domain-name>/getters.spec.js` were not executed in Circle CI. This PR fixes the issue, along with the following changes: - Use vitest instead of jest - Remove jest dependancies - Update tests to work with vitest --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
50 lines
1000 B
JavaScript
50 lines
1000 B
JavaScript
import { getters } from '../../accounts';
|
|
|
|
const accountData = {
|
|
id: 1,
|
|
name: 'Company one',
|
|
locale: 'en',
|
|
features: {
|
|
auto_resolve_conversations: true,
|
|
agent_management: false,
|
|
},
|
|
};
|
|
|
|
describe('#getters', () => {
|
|
it('getAccount', () => {
|
|
const state = {
|
|
records: [accountData],
|
|
};
|
|
expect(getters.getAccount(state)(1)).toEqual(accountData);
|
|
});
|
|
it('getUIFlags', () => {
|
|
const state = {
|
|
uiFlags: {
|
|
isFetching: true,
|
|
isCreating: false,
|
|
isUpdating: false,
|
|
isDeleting: false,
|
|
},
|
|
};
|
|
expect(getters.getUIFlags(state)).toEqual({
|
|
isFetching: true,
|
|
isCreating: false,
|
|
isUpdating: false,
|
|
isDeleting: false,
|
|
});
|
|
});
|
|
|
|
it('isFeatureEnabledonAccount', () => {
|
|
const state = {
|
|
records: [accountData],
|
|
};
|
|
expect(
|
|
getters.isFeatureEnabledonAccount(
|
|
state,
|
|
null,
|
|
null
|
|
)(1, 'auto_resolve_conversations')
|
|
).toEqual(true);
|
|
});
|
|
});
|