From 8c3aeec6adccf973be6b94a9bd797e359649f7f2 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sat, 6 Feb 2016 22:05:07 -0500 Subject: [PATCH] Failing test --- js/test/test-mux.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/js/test/test-mux.js b/js/test/test-mux.js index 88d6c03..f0644eb 100644 --- a/js/test/test-mux.js +++ b/js/test/test-mux.js @@ -256,4 +256,24 @@ describe('computeEvents', function () { expect(events.metaEvents.get(0).equals(Patch.emptyPatch)).to.be(true); }); }); + + describe('for a no-op but nonempty patch', function () { + var oldM = new Mux.Mux(); + var pid1 = oldM.addStream(Patch.assert(["fieldContents", "initial", 7])).pid; + var pid2 = oldM.addStream(Patch.sub(["fieldContents", __, __])).pid; + var newM = oldM.shallowCopy(); + var updateStreamResult = + newM.updateStream(pid1, + Patch.retract(["fieldContents", __, __]) + .andThen(Patch.assert(["fieldContents", "initial", 7]))); + var events = Mux.computeEvents(oldM, newM, updateStreamResult); + + it('should send an empty patch to the subscriber', function () { + expect(events.eventMap.size).to.be(1); + expect(events.eventMap.has(pid2)).to.be(true); + checkPrettyPatch(events.eventMap.get(pid2).strip(), + ['::: nothing'], + ['::: nothing']); + }); + }); });