mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-10 11:09:43 +08:00
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:
parent
83357075c4
commit
c42a8a326c
@ -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', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user