summaryrefslogtreecommitdiffstats
path: root/tests/javascript/unit/store/feed.spec.ts
diff options
context:
space:
mode:
authorDevlin Junker <devlin.junker@gmail.com>2023-08-24 14:52:54 -0700
committerBenjamin Brahmer <info@b-brahmer.de>2023-08-26 07:48:18 +0200
commit8183510385bad408ea3f0136bd4a5487ba7df526 (patch)
treef5cb61b97eb62f1cabb5ad506e47e8d982fc3d63 /tests/javascript/unit/store/feed.spec.ts
parent3f34e3da33e4e20995f33f69ad8e6fed1a7bad72 (diff)
More cleanup and started on unit tests
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
Diffstat (limited to 'tests/javascript/unit/store/feed.spec.ts')
-rw-r--r--tests/javascript/unit/store/feed.spec.ts20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/javascript/unit/store/feed.spec.ts b/tests/javascript/unit/store/feed.spec.ts
index 922c79f3f..3a7521f89 100644
--- a/tests/javascript/unit/store/feed.spec.ts
+++ b/tests/javascript/unit/store/feed.spec.ts
@@ -3,7 +3,7 @@ import { Feed } from '../../../../src/types/Feed'
import { AppState } from '../../../../src/store'
import { FEED_ACTION_TYPES, mutations, actions } from '../../../../src/store/feed'
-import { FEED_MUTATION_TYPES } from '../../../../src/types/MutationTypes'
+import { FEED_ITEM_MUTATION_TYPES, FEED_MUTATION_TYPES } from '../../../../src/types/MutationTypes'
jest.mock('@nextcloud/axios')
@@ -11,6 +11,17 @@ describe('feed.ts', () => {
'use strict'
describe('actions', () => {
+ describe('FETCH_FEEDS', () => {
+ it('should call GET and commit returned feeds to state', async () => {
+ (axios as any).get.mockResolvedValue({ data: { feeds: [] } })
+ const commit = jest.fn()
+ await (actions[FEED_ACTION_TYPES.FETCH_FEEDS] as any)({ commit })
+ expect(axios.get).toBeCalled()
+ expect(commit).toBeCalledWith(FEED_MUTATION_TYPES.SET_FEEDS, [])
+ expect(commit).toBeCalledWith(FEED_ITEM_MUTATION_TYPES.SET_UNREAD_COUNT, 0)
+ })
+ })
+
describe('ADD_FEED', () => {
it('should call POST and commit feed to state', async () => {
(axios as any).post.mockResolvedValue({ data: { feeds: [] } })
@@ -30,13 +41,6 @@ describe('feed.ts', () => {
})
})
- it('FETCH_FEEDS should call GET and commit returned feeds to state', async () => {
- (axios as any).get.mockResolvedValue({ data: { feeds: [] } })
- const commit = jest.fn()
- await (actions[FEED_ACTION_TYPES.FETCH_FEEDS] as any)({ commit })
- expect(axios.get).toBeCalled()
- expect(commit).toBeCalled()
- })
})
describe('mutations', () => {