squiggle/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_Topology_test.res

37 lines
882 B
Plaintext
Raw Permalink Normal View History

2022-08-25 19:59:15 +00:00
@@warning("-44")
module Topology = ReducerProject_Topology
open Jest
open Expect
open Expect.Operators
2022-08-25 23:32:38 +00:00
describe("Topology Diff", () => {
2022-08-25 22:45:13 +00:00
test("when equal 1x", () => {
2022-08-25 19:59:15 +00:00
Topology.runOrderDiff(["a"], ["a"])->expect == []
})
test("when equal 3x", () => {
Topology.runOrderDiff(["a", "b", "c"], ["a", "b", "c"])->expect == []
})
2022-08-25 22:45:13 +00:00
test("less dependents", () => {
Topology.runOrderDiff(["a", "b"], ["a", "b", "c", "d"])->expect == []
})
test("more dependents", () => {
Topology.runOrderDiff(["a", "b", "c", "d"], ["a", "b"])->expect == ["c", "d"]
})
2022-08-25 23:32:38 +00:00
test("change midway", () => {
Topology.runOrderDiff(["a", "b", "bb", "c", "d"], ["a", "b", "c", "d"])->expect == [
"bb",
"c",
"d",
]
})
test("swap", () => {
Topology.runOrderDiff(["a", "b", "c", "d"], ["a", "c", "b", "d"])->expect == ["b", "c", "d"]
})
2022-08-25 19:59:15 +00:00
})