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);
  }
```
This commit is contained in:
AlbertGao 2021-02-08 23:56:40 +13:00 committed by GitHub
parent 83357075c4
commit c42a8a326c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,6 +246,9 @@ describe('Graph', () => {
expect(graph.getAllEdges().length).toBe(2); expect(graph.getAllEdges().length).toBe(2);
expect(graph.getAllEdges()[0].getKey()).toBe(edgeBC.getKey()); expect(graph.getAllEdges()[0].getKey()).toBe(edgeBC.getKey());
expect(graph.getAllEdges()[1].getKey()).toBe(edgeAC.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', () => { it('should should throw an error when trying to delete not existing edge', () => {