Skip to content

Commit 0f0b0de

Browse files
Hive. ListStore, SET method bug and not correct logic in test for setStore (#233)
1 parent fd86d75 commit 0f0b0de

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/hive/stores/list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class ListStore extends HiveStore {
4141
}
4242

4343
set(value, index) {
44-
if (typeof index === undefined) {
44+
if (typeof index === 'undefined') {
4545
if (!value || !Array.isArray(value) || !value.length || !isHiveValueValid(value)) {
4646
throw new Error('Value must be provided and must be a list of valid JSON items.')
4747
}

test/unit/specs/hive/set.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -804,12 +804,12 @@ describe('Hive - Set Store', function() {
804804
it('fails with invalid value', async () => {
805805
const errorMsg = 'Value must be provided and must be one of types: string, number, boolean, object, array.'
806806

807-
await expect(() => store.setValue(undefined)).to.throw(errorMsg)
808-
await expect(() => store.setValue(null)).to.throw(errorMsg)
809-
await expect(() => store.setValue(() => true)).to.throw(errorMsg)
810-
await expect(() => store.setValue(10n)).to.throw(errorMsg)
811-
await expect(() => store.setValue(Symbol('id'))).to.throw(errorMsg)
812-
await expect(() => store.setValue([10n])).to.throw(errorMsg)
807+
await expect(() => store.addValue(undefined)).to.throw(errorMsg)
808+
await expect(() => store.addValue(null)).to.throw(errorMsg)
809+
await expect(() => store.addValue(() => true)).to.throw(errorMsg)
810+
await expect(() => store.addValue(10n)).to.throw(errorMsg)
811+
await expect(() => store.addValue(Symbol('id'))).to.throw(errorMsg)
812+
await expect(() => store.addValue([10n])).to.throw(errorMsg)
813813
})
814814
})
815815

0 commit comments

Comments
 (0)