Chatwoot/app/javascript/dashboard/store/modules/helpCenterArticles/specs/getters.spec.js
Sivin Varghese 03c8251cc3
feat: Adds the ability to publish an article (#5365)
* feat: Adds the ability to publish an article

* chore: Disabled publish button and dropdown when there is no article id

* chore: Review fixes

* chore: Review fixes

* Update app/javascript/dashboard/routes/dashboard/helpcenter/components/Header/EditArticleHeader.vue

* chore: Review fixes

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2022-09-02 12:53:18 +05:30

44 lines
1.1 KiB
JavaScript

import { getters } from '../getters';
import articles from './fixtures';
describe('#getters', () => {
let state = {};
beforeEach(() => {
state = articles;
});
it('uiFlags', () => {
expect(getters.uiFlags(state)(1)).toEqual({
isFetching: false,
isUpdating: true,
isDeleting: false,
});
});
it('articleById', () => {
expect(getters.articleById(state)(1)).toEqual({
id: 1,
category_id: 1,
title: 'Documents are required to complete KYC',
content:
'The submission of the following documents is mandatory to complete registration, ID proof - PAN Card, Address proof',
description: 'Documents are required to complete KYC',
status: 'draft',
account_id: 1,
views: 122,
author: {
id: 5,
account_id: 1,
email: 'tom@furrent.com',
available_name: 'Tom',
name: 'Tom Jose',
},
});
});
it('articleStatus', () => {
expect(getters.articleStatus(state)(1)).toEqual('draft');
});
it('isFetchingArticles', () => {
expect(getters.isFetching(state)).toEqual(true);
});
});