Skip to content

Commit

Permalink
chore(jest): increase coverage on store/textile/getters.test.ts (#2925)
Browse files Browse the repository at this point in the history
  • Loading branch information
stavares843 committed Apr 19, 2022
1 parent 885cf65 commit 7777307
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
10 changes: 10 additions & 0 deletions store/textile/__snapshots__/getters.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`getters.default.getConversation 0 1`] = `[Function]`;

exports[`getters.default.getConversation 1 1`] = `[Function]`;

exports[`getters.default.getConversation 2 1`] = `[Function]`;

exports[`getters.default.getConversationMessages 0 1`] = `[Function]`;

exports[`getters.default.getInitialized 0 1`] = `true`;

exports[`init should return the initialized variable of the state 1`] = `false`;
74 changes: 74 additions & 0 deletions store/textile/getters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,77 @@ describe('init', () => {
expect(result).not.toEqual({})
})
})

describe('getters.default.getInitialized', () => {
test('0', () => {
const result: any = getters.default.getInitialized({
initialized: true,
activeConversation: 'da7588892',
conversations: {},
conversationLoading: true,
messageLoading: false,
uploadProgress: {
key0: { progress: 300, finished: false, name: 'Pierre Edouard' },
key1: { progress: 0.0, finished: true, name: 'Michael' },
key2: { progress: 0.0, finished: true, name: 'Jean-Philippe' },
},
})
expect(result).toMatchSnapshot()
})
})

describe('getters.default.getConversationMessages', () => {
test('0', () => {
const result: any = getters.default.getConversationMessages({
initialized: true,
activeConversation: '',
conversations: {},
conversationLoading: false,
messageLoading: false,
uploadProgress: {
key0: { progress: NaN, finished: false, name: '' },
key1: { progress: NaN, finished: false, name: '' },
key2: { progress: NaN, finished: true, name: '' },
},
})
expect(result).toMatchSnapshot()
})
})

describe('getters.default.getConversation', () => {
test('0', () => {
const result: any = getters.default.getConversation({
initialized: true,
activeConversation: '9876',
conversations: {},
conversationLoading: false,
messageLoading: true,
uploadProgress: {},
})
expect(result).toMatchSnapshot()
})

test('1', () => {
const result: any = getters.default.getConversation({
initialized: false,
activeConversation: 'bc23a9d531064583ace8f67dad60f6bb',
conversations: {},
conversationLoading: true,
messageLoading: false,
uploadProgress: {},
})
expect(result).toMatchSnapshot()
})

test('2', () => {
const result: any = getters.default.getConversation({
initialized: false,
activeConversation: '',
conversations: {},
conversationLoading: true,
messageLoading: true,
uploadProgress: {},
})
expect(result).toMatchSnapshot()
})
})

0 comments on commit 7777307

Please sign in to comment.