From 0d7621727eea8e82a3637cd28662ea21cd1997fd Mon Sep 17 00:00:00 2001 From: Micah Geisel Date: Sun, 19 Jan 2025 10:54:14 -0600 Subject: [PATCH] tests for smart soft matching during common mutations. --- test/ops.js | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/test/ops.js b/test/ops.js index 9138c01..cb605b2 100644 --- a/test/ops.js +++ b/test/ops.js @@ -60,4 +60,108 @@ describe("morphing operations", function () { ], ); }); + + it.skip("prepending a new softmatchable node onto the beginning", function () { + assertOps( + "
AB
", + "
NewAB
", + [ + [ + "Morphed", + "
AB
", + "
NewAB
", + ], + ["Added", "New"], + ["Morphed", "A", "A"], + ["Morphed", "B", "B"], + ], + ); + }); + + it.skip("inserting a new softmatchable node into the middle", function () { + assertOps( + "
ABCD
", + "
ABNewCD
", + [ + [ + "Morphed", + "
ABCD
", + "
ABNewCD
", + ], + ["Morphed", "A", "A"], + ["Morphed", "B", "B"], + ["Added", "New"], + ["Morphed", "C", "C"], + ["Morphed", "D", "D"], + ], + ); + }); + + it("appending a new softmatchable node onto the end", function () { + assertOps( + "
AB
", + "
ABNew
", + [ + [ + "Morphed", + "
AB
", + "
ABNew
", + ], + ["Morphed", "A", "A"], + ["Morphed", "B", "B"], + ["Added", "New"], + ], + ); + }); + + it.skip("removing a softmatchable node from the front", function () { + assertOps( + "
ABC
", + "
BC
", + [ + [ + "Morphed", + "
ABC
", + "
BC
", + ], + ["Removed", "A"], + ["Morphed", "B", "B"], + ["Morphed", "C", "C"], + ], + ); + }); + + it.skip("removing a softmatchable node from the middle", function () { + assertOps( + "
ABC
", + "
AC
", + [ + [ + "Morphed", + "
ABC
", + "
AC
", + ], + ["Morphed", "A", "A"], + ["Removed", "B"], + ["Morphed", "C", "C"], + ], + ); + }); + + it("removing a softmatchable node from the end", function () { + assertOps( + "
ABC
", + "
AB
", + [ + [ + "Morphed", + "
ABC
", + "
AB
", + ], + ["Morphed", "A", "A"], + ["Morphed", "B", "B"], + ["Removed", "C"], + ], + ); + }); });