flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.
MIT License
2.99k stars 213 forks source link

added tests for issue #141 #144

Open atuttle opened 5 years ago

atuttle commented 5 years ago

While my findings don't totally agree with what's described in #141, they do show some bugs. In particular, it seems like revert doesn't work at all unless I'm misunderstanding how to use it, or I've made a JS variable memory-reference error).

Plus, I don't see any other tests for revert, so now there will be a few. šŸ˜„

  83 passing (227ms)
  4 failing

  1) deep-diff
       regression test for issue #141
         reverts changes correctly when both values are truthy:
     Error: expected 'hello' to equal 1
      at Assertion.assert (node_modules/expect.js/index.js:96:13)
      at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
      at Context.<anonymous> (test/tests.js:607:31)

  2) deep-diff
       regression test for issue #141
         reverts changes correctly when both values are falsey:
     Error: expected 'hello' to equal -1
      at Assertion.assert (node_modules/expect.js/index.js:96:13)
      at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
      at Context.<anonymous> (test/tests.js:613:31)

  3) deep-diff
       regression test for issue #141
         reverts changes correctly when the new value is truthy:
     Error: expected 3 to equal 1
      at Assertion.assert (node_modules/expect.js/index.js:96:13)
      at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
      at Context.<anonymous> (test/tests.js:619:31)

  4) deep-diff
       regression test for issue #141
         reverts changes correctly when the new value is falsey:
     Error: expected 1 to equal -1
      at Assertion.assert (node_modules/expect.js/index.js:96:13)
      at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
      at Context.<anonymous> (test/tests.js:625:31)