tests: update nodes tests

This commit is contained in:
braks
2023-05-25 20:48:26 +02:00
committed by Braks
parent 910a3543f6
commit 669a2a3f8c
5 changed files with 60 additions and 23 deletions
@@ -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)
})
})