tgriesser / immutable-diff

Hi-Fi diffing for Immutable.js data structures, forked from immutablediff
MIT License
12 stars 2 forks source link

bug in 'no replace in equal nested structure' test? #4

Closed NodeGuy closed 7 years ago

NodeGuy commented 7 years ago

The following test appears to be expecting no operation according the prose description but the code is expecting and seeing a replace operation. Isn't the description's the correct behavior?

    JSC.test(
      'no replace in equal nested structure',
      function(veredict, obj, obj2) {
        var map1 = fromJS(obj);
        var map2 = fromJS(obj).set('a', obj2.a);

        var result = diff(map1, map2);
        var expected = fromJS([{op: 'replace', path: ['a'], value: obj2.a}]);

        return veredict(is(result, expected));
      },
      [
        JSC.object({
          a: JSC.integer(),
          b: JSC.object({
            c: JSC.integer()
          })
        }),
        JSC.object({
          a: JSC.integer()
        })
      ]
    );
NodeGuy commented 7 years ago

Never mind, I understand it now.