From 5496d090e05454063697c2750aff3acd90be78ef Mon Sep 17 00:00:00 2001 From: Andre Christoga Pramaditya Date: Fri, 20 May 2022 22:48:55 +0700 Subject: [PATCH] feat(jest): 100% branch coverage for store/chat/mutations (#3252) --- .../chat/__snapshots__/mutations.test.ts.snap | 2 ++ store/chat/mutations.test.ts | 19 ++++--------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/store/chat/__snapshots__/mutations.test.ts.snap b/store/chat/__snapshots__/mutations.test.ts.snap index 661d1e5d5b..e17a1e27ea 100644 --- a/store/chat/__snapshots__/mutations.test.ts.snap +++ b/store/chat/__snapshots__/mutations.test.ts.snap @@ -1,5 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`misc module.default.addFile with empty files array 1`] = `Array []`; + exports[`module.default.addFile 0 1`] = `undefined`; exports[`module.default.addFile 1 1`] = `undefined`; diff --git a/store/chat/mutations.test.ts b/store/chat/mutations.test.ts index 72a434f6b3..07aa54b918 100644 --- a/store/chat/mutations.test.ts +++ b/store/chat/mutations.test.ts @@ -234,22 +234,11 @@ describe('misc', () => { module.default.addFile(state, obj) expect(state.files[obj.address]).toEqual([obj.file]) }) - test.skip('draft module.default.addFile with non-empty files array', () => { - const state = { - replies: object, - chatTexts: object2, - files: [ - { - file: 'path_file_0', - nsfw: { checking: false, status: false }, - url: 'string', - }, - ], - } + test('module.default.addFile with empty files array', () => { const obj = { file: { - file: 'path', - url: 'string', + file: 'path2', + url: 'string2', nsfw: { checking: false, status: false, @@ -258,7 +247,7 @@ describe('misc', () => { address: 'address1', } module.default.addFile(state, obj) - expect(state.files[obj.address]).toEqual([obj.file]) + expect(state.files).toMatchSnapshot() }) test('module.default.setFiles', () => { const state = { replies: object, chatTexts: object2, files: object3 }