summaryrefslogtreecommitdiffstats
path: root/tests/javascript/unit/services/item.service.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/javascript/unit/services/item.service.spec.ts')
-rw-r--r--tests/javascript/unit/services/item.service.spec.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/javascript/unit/services/item.service.spec.ts b/tests/javascript/unit/services/item.service.spec.ts
index 29de8f1a3..005248709 100644
--- a/tests/javascript/unit/services/item.service.spec.ts
+++ b/tests/javascript/unit/services/item.service.spec.ts
@@ -12,7 +12,7 @@ describe('item.service.ts', () => {
})
describe('fetchStarred', () => {
- it('should call GET with offset set to start param', async () => {
+ it('should call GET with offset set to start param and STARRED item type', async () => {
(axios as any).get.mockResolvedValue({ data: { feeds: [] } })
await ItemService.fetchStarred(0)
@@ -26,7 +26,7 @@ describe('item.service.ts', () => {
})
describe('fetchUnread', () => {
- it('should call GET with offset set to start param', async () => {
+ it('should call GET with offset set to start param and UNREAD item type', async () => {
(axios as any).get.mockResolvedValue({ data: { feeds: [] } })
await ItemService.fetchUnread(2)
@@ -39,6 +39,21 @@ describe('item.service.ts', () => {
})
})
+ describe('fetchFeedItems', () => {
+ it('should call GET with offset set to start param, UNREAD item type, and id set to feedId', async () => {
+ (axios as any).get.mockResolvedValue({ data: { feeds: [] } })
+
+ await ItemService.fetchFeedItems(123, 0)
+
+ expect(axios.get).toBeCalled()
+ const queryParams = (axios.get as any).mock.calls[0][1].params
+
+ expect(queryParams.id).toEqual(123)
+ expect(queryParams.offset).toEqual(0)
+ expect(queryParams.type).toEqual(ITEM_TYPES.ALL)
+ })
+ })
+
describe('markRead', () => {
it('should call POST with item id in URL and read param', async () => {
await ItemService.markRead({ id: 123 } as any, true)