fix(fast rebuild): handle added an deleted markdown correctly ()

* Handle added files correctly

* Handle deletes properly

* addGraph renamed to mergeGraph
This commit is contained in:
kabirgh 2024-02-24 02:40:42 +00:00 committed by GitHub
parent 6be1ed1ea2
commit a6417c447a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 84 additions and 12 deletions

View file

@ -39,6 +39,28 @@ describe("DepGraph", () => {
})
})
describe("mergeGraph", () => {
test("merges two graphs", () => {
const graph = new DepGraph<string>()
graph.addEdge("A.md", "A.html")
const other = new DepGraph<string>()
other.addEdge("B.md", "B.html")
graph.mergeGraph(other)
const expected = {
nodes: ["A.md", "A.html", "B.md", "B.html"],
edges: [
["A.md", "A.html"],
["B.md", "B.html"],
],
}
assert.deepStrictEqual(graph.export(), expected)
})
})
describe("updateIncomingEdgesForNode", () => {
test("merges when node exists", () => {
// A.md -> B.md -> B.html