Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/coalesce adjacent remove add into replace #41

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

manishbhatias
Copy link

Comparision of path for adjacent add + remove operation was broken when offset functionality was introduced

Test case

let jif = require('jiff');
let a = [1,2,3];
let b = [4,2,3];
console.log(jif.diff(a, b, {invertible:false}));

Result

Array (2 items)
0: Object {context: undefined, op: "add", path: "/0", value: 4}
1: Object {context: undefined, op: "remove", path: "/1"}

Expected Result

Array (1 item)
0: Object {context: undefined, op: "replace", path: "/0", value: 4}

Signed-off-by: Manish Bhatia [email protected]

@manishbhatias manishbhatias force-pushed the fix/coalesce-adjacent-remove-add-into-replace branch from d6617a9 to 8447149 Compare January 31, 2020 18:26
@briancavalier
Copy link
Member

Hey @manishbhatias, sorry for the delay, and thank you for adding a test. There seem to be 3 new test failures in this PR branch, whereas all pass on master:

Screen Shot 2020-02-14 at 8 49 55 AM

Could you look into those? Thanks!

@manishbhatias
Copy link
Author

@briancavalier I have added a fix for the failing test cases and have adjusted my additional test case to account for the invertible patch option.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants