tests: update nodes tests
This commit is contained in:
@@ -20,10 +20,27 @@ describe('Store Action: `findNode`', () => {
|
||||
|
||||
it('finds node in store', () => {
|
||||
const storedNode = store.findNode(nodes[randomIndex].id)
|
||||
expect(storedNode?.id).to.equal(nodes[randomIndex].id)
|
||||
|
||||
if (!storedNode) {
|
||||
throw new Error('Node not found in store')
|
||||
}
|
||||
|
||||
expect(storedNode.id).to.equal(nodes[randomIndex].id)
|
||||
})
|
||||
|
||||
it('does not find node in store when passed invalid id', () => {
|
||||
expect(store.findNode('-123')).to.equal(undefined)
|
||||
expect(store.findNode('some-invalid-id')).to.equal(undefined)
|
||||
})
|
||||
|
||||
it('does not find node in store when passed undefined', () => {
|
||||
expect(store.findNode(undefined)).to.equal(undefined)
|
||||
})
|
||||
|
||||
it('does not find node in store when passed empty string', () => {
|
||||
expect(store.findNode('')).to.equal(undefined)
|
||||
})
|
||||
|
||||
it('does not find node in store when passed number', () => {
|
||||
expect(store.findNode(123 as any)).to.equal(undefined)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user