Skip to content

Commit 4cd4a83

Browse files
committed
test: add asserts to existing action tests for new isPendingById getters
1 parent 066432c commit 4cd4a83

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/service-module/service-module.actions.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,8 @@ describe('Service Module - Actions', () => {
928928
assert(todoState.ids.length === 1)
929929
assert(todoState.errorOnUpdate === null)
930930
assert(todoState.isUpdatePending === false)
931+
assert(store.getters['my-todos/isUpdatePendingById'](0) === false, 'ID pending update clear')
932+
assert(store.getters['my-todos/isPendingById'](0) === false, 'ID pending clear')
931933
assert.deepEqual(
932934
todoState.keyedById[responseFromUpdate.id],
933935
responseFromUpdate
@@ -939,6 +941,8 @@ describe('Service Module - Actions', () => {
939941
assert(todoState.ids.length === 1)
940942
assert(todoState.errorOnUpdate === null)
941943
assert(todoState.isUpdatePending === true)
944+
assert(store.getters['my-todos/isUpdatePendingById'](0) === true, 'ID pending update set')
945+
assert(store.getters['my-todos/isPendingById'](0) === true, 'ID pending set')
942946
assert(todoState.idField === 'id')
943947
})
944948
.catch(error => {
@@ -1022,6 +1026,8 @@ describe('Service Module - Actions', () => {
10221026
assert(todoState.ids.length === 1)
10231027
assert(todoState.errorOnPatch === null)
10241028
assert(todoState.isPatchPending === false)
1029+
assert(store.getters['my-todos/isPatchPendingById'](0) === false, 'ID pending patch clear')
1030+
assert(store.getters['my-todos/isPendingById'](0) === false, 'ID pending clear')
10251031
assert.deepEqual(
10261032
todoState.keyedById[responseFromPatch.id],
10271033
responseFromPatch
@@ -1033,6 +1039,8 @@ describe('Service Module - Actions', () => {
10331039
assert(todoState.ids.length === 1)
10341040
assert(todoState.errorOnPatch === null)
10351041
assert(todoState.isPatchPending === true)
1042+
assert(store.getters['my-todos/isPatchPendingById'](0) === true, 'ID pending patch set')
1043+
assert(store.getters['my-todos/isPendingById'](0) === true, 'ID pending set')
10361044
assert(todoState.idField === 'id')
10371045
})
10381046
})
@@ -1098,6 +1106,8 @@ describe('Service Module - Actions', () => {
10981106
assert(todoState.ids.length === 1)
10991107
assert(todoState.errorOnPatch === null)
11001108
assert(todoState.isPatchPending === false)
1109+
assert(store.getters['my-todos/isPatchPendingById'](0) === false, 'ID pending patch clear')
1110+
assert(store.getters['my-todos/isPendingById'](0) === false, 'ID pending clear')
11011111
assert.deepEqual(
11021112
todoState.keyedById[responseFromPatch.id],
11031113
responseFromPatch
@@ -1109,6 +1119,8 @@ describe('Service Module - Actions', () => {
11091119
assert(todoState.ids.length === 1)
11101120
assert(todoState.errorOnPatch === null)
11111121
assert(todoState.isPatchPending === true)
1122+
assert(store.getters['my-todos/isPatchPendingById'](0) === true, 'ID pending patch set')
1123+
assert(store.getters['my-todos/isPendingById'](0) === true, 'ID pending set')
11121124
assert(todoState.idField === 'id')
11131125
})
11141126
})
@@ -1174,6 +1186,8 @@ describe('Service Module - Actions', () => {
11741186
assert(todoState.ids.length === 0)
11751187
assert(todoState.errorOnRemove === null)
11761188
assert(todoState.isRemovePending === false)
1189+
assert(store.getters['my-todos/isRemovePendingById'](0) === false, 'ID pending remove clear')
1190+
assert(store.getters['my-todos/isPendingById'](0) === false, 'ID pending clear')
11771191
assert.deepEqual(todoState.keyedById, {})
11781192
done()
11791193
})
@@ -1186,6 +1200,8 @@ describe('Service Module - Actions', () => {
11861200
assert(todoState.ids.length === 1)
11871201
assert(todoState.errorOnRemove === null)
11881202
assert(todoState.isRemovePending === true)
1203+
assert(store.getters['my-todos/isRemovePendingById'](0) === true, 'ID pending remove set')
1204+
assert(store.getters['my-todos/isPendingById'](0) === true, 'ID pending set')
11891205
assert(todoState.idField === 'id')
11901206
})
11911207
})

0 commit comments

Comments
 (0)