Skip to content

Commit b528add

Browse files
authored
test(dht): Equality check in Mock-Layer1-Layer0.test.ts (#3129)
Use `toIncludeSameMembers()` instead of `toContainValues()`. The `toIncludeSameMembers()` is better check as both arrays should match exactly. In a previous line already check that there are equal items in the list, i.e. the lists won't contain additional values (which would be tolerated by `toContainValues()` but not by `toIncludeSameMembers()` ) ```ts expect(layer1Node1.getNeighborCount()).toEqual(layer0Node1.getNeighborCount()) ``` This should resolve the test failure in #3127.
1 parent 2caab62 commit b528add

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/dht/test/integration/Mock-Layer1-Layer0.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ describe('Layer 1 on Layer 0 with mocked connections', () => {
7676
expect(layer1Node3.getNeighborCount()).toEqual(layer0Node3.getNeighborCount())
7777
expect(layer1Node4.getNeighborCount()).toEqual(layer0Node4.getNeighborCount())
7878

79-
expect(layer1Node1.getNeighbors()).toContainValues(layer0Node1.getNeighbors())
80-
expect(layer1Node2.getNeighbors()).toContainValues(layer0Node2.getNeighbors())
81-
expect(layer1Node3.getNeighbors()).toContainValues(layer0Node3.getNeighbors())
82-
expect(layer1Node4.getNeighbors()).toContainValues(layer0Node4.getNeighbors())
79+
expect(layer1Node1.getNeighbors()).toIncludeSameMembers(layer0Node1.getNeighbors())
80+
expect(layer1Node2.getNeighbors()).toIncludeSameMembers(layer0Node2.getNeighbors())
81+
expect(layer1Node3.getNeighbors()).toIncludeSameMembers(layer0Node3.getNeighbors())
82+
expect(layer1Node4.getNeighbors()).toIncludeSameMembers(layer0Node4.getNeighbors())
8383

8484
}, 60000)
8585
})

0 commit comments

Comments
 (0)