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

* Handle added files correctly

* Handle deletes properly

* addGraph renamed to mergeGraph
This commit is contained in:
kabirgh authored and GitHub committed 2024-02-23 18:40:42 -08:00
1 parent 6be1ed1ea2
commit a6417c447a
3 files changed
+84 -12

No files matched your search

+22
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