Skip to content

Commit

Permalink
feat(jest): 100% coverage for store/chat/mutations (#3904)
Browse files Browse the repository at this point in the history
  • Loading branch information
drepram committed Jul 1, 2022
1 parent 583d7a4 commit 0534676
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions store/chat/mutations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1046,4 +1046,61 @@ describe('misc', () => {
size: 10,
})
})

test('module.removeFile', () => {
const localState = {
...InitialChatState,
files: {
file1: [
{
file: 'path2',
url: 'string2',
nsfw: {
checking: false,
status: false,
},
progress: 0,
},
],
},
}
const argument = { address: 'file1', index: 0 }

module.default.removeFile(localState, argument)

expect(localState.files).toEqual({ file1: [] })
})

test('module.setFileProgress', () => {
const localState = {
...InitialChatState,
files: {
file1: [
{
file: 'path2',
url: 'string2',
nsfw: {
checking: false,
status: false,
},
progress: 0,
},
],
},
}
const argument = { address: 'file1', index: 0, progress: 10 }

module.default.setFileProgress(localState, argument)

expect(localState.files).toEqual({
file1: [
{
file: 'path2',
nsfw: { checking: false, status: false },
progress: 10,
url: 'string2',
},
],
})
})
})

0 comments on commit 0534676

Please sign in to comment.