2022-07-27 06:59:11 +00:00
|
|
|
import { getters } from '../getters';
|
|
|
|
import articles from './fixtures';
|
|
|
|
describe('#getters', () => {
|
|
|
|
let state = {};
|
|
|
|
beforeEach(() => {
|
|
|
|
state = articles;
|
|
|
|
});
|
2022-08-02 11:44:10 +00:00
|
|
|
it('uiFlags', () => {
|
|
|
|
expect(getters.uiFlags(state)(1)).toEqual({
|
2022-07-27 06:59:11 +00:00
|
|
|
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',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-09-02 07:23:18 +00:00
|
|
|
it('articleStatus', () => {
|
|
|
|
expect(getters.articleStatus(state)(1)).toEqual('draft');
|
|
|
|
});
|
|
|
|
|
2022-08-02 11:44:10 +00:00
|
|
|
it('isFetchingArticles', () => {
|
|
|
|
expect(getters.isFetching(state)).toEqual(true);
|
2022-07-27 06:59:11 +00:00
|
|
|
});
|
|
|
|
});
|