Compare commits

...

2 Commits

Author SHA1 Message Date
AlbertGao
af3a9358fc
Merge c42a8a326c into 2c67b48c21 2024-04-25 08:24:46 +08:00
AlbertGao
c42a8a326c
Update Graph.test.js
To cover the below logic in `Graph class`

```javascript
  deleteEdge(edge) {
    // omit

    const start = this.getVertexByKey(edge.startVertex.getKey());
    const end = this.getVertexByKey(edge.endVertex.getKey());

    start.deleteEdge(edge);
    end.deleteEdge(edge);
  }
```
2021-02-08 23:56:40 +13:00

View File

@ -246,6 +246,9 @@ describe('Graph', () => {
expect(graph.getAllEdges().length).toBe(2);
expect(graph.getAllEdges()[0].getKey()).toBe(edgeBC.getKey());
expect(graph.getAllEdges()[1].getKey()).toBe(edgeAC.getKey());
expect(vertexA.hasEdge(edgeAB)).toBe(false);
expect(vertexB.hasEdge(edgeAB)).toBe(false)
});
it('should should throw an error when trying to delete not existing edge', () => {