summaryrefslogtreecommitdiffstats
path: root/tests/javascript/unit/store/item.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/javascript/unit/store/item.spec.ts')
-rw-r--r--tests/javascript/unit/store/item.spec.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/javascript/unit/store/item.spec.ts b/tests/javascript/unit/store/item.spec.ts
index c393a03f4..84869c4d8 100644
--- a/tests/javascript/unit/store/item.spec.ts
+++ b/tests/javascript/unit/store/item.spec.ts
@@ -37,6 +37,21 @@ describe('item.ts', () => {
})
})
+ describe('FETCH_FEED_ITEMS', () => {
+ it('should call ItemService and commit items to state', async () => {
+ const mockItems = [{ id: 123, title: 'feed item' }]
+ const fetchMock = jest.fn()
+ fetchMock.mockResolvedValue({ data: { items: mockItems } })
+ ItemService.debounceFetchFeedItems = fetchMock as any
+ const commit = jest.fn()
+
+ await (actions[FEED_ITEM_ACTION_TYPES.FETCH_FEED_ITEMS] as any)({ commit }, { feedId: 123 })
+
+ expect(fetchMock).toBeCalled()
+ expect(commit).toBeCalledWith(FEED_ITEM_MUTATION_TYPES.SET_ITEMS, mockItems)
+ })
+ })
+
it('MARK_READ should call GET and commit returned feeds to state', async () => {
const item = { id: 1 }
const commit = jest.fn()