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']); + }); + }); });