Skip to content

Commit

Permalink
Fix existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ExplodingCabbage committed Dec 27, 2023
1 parent 1cfb0bf commit 506a21b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions test/diff/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ describe('diff/array', function() {
console.log(diffResult);
expect(diffResult).to.deep.equals([
{count: 1, value: [a]},
{count: 1, value: [c], removed: undefined, added: true},
{count: 1, value: [b]},
{count: 1, value: [c], removed: true, added: undefined}
{count: 1, value: [b], removed: true, added: undefined},
{count: 1, value: [c]},
{count: 1, value: [b], removed: undefined, added: true}
]);
});
it('should diff falsey values', function() {
const a = false;
const b = 0;
const c = '';
// Example sequences from Myers 1986
const arrayA = [c, b, a, b, a, c];
const arrayB = [a, b, c, a, b, b, a];
const arrayA = [a, b, c, a, b, b, a];
const arrayB = [c, b, a, b, a, c];
const diffResult = diffArrays(arrayA, arrayB);
expect(diffResult).to.deep.equals([
{count: 2, value: [a, b], removed: undefined, added: true},
{count: 2, value: [a, b], removed: true, added: undefined},
{count: 1, value: [c]},
{count: 1, value: [b], removed: true, added: undefined},
{count: 2, value: [a, b]},
{count: 1, value: [b], removed: undefined, added: true},
{count: 2, value: [a, b]},
{count: 1, value: [b], removed: true, added: undefined},
{count: 1, value: [a]},
{count: 1, value: [c], removed: true, added: undefined}
{count: 1, value: [c], removed: undefined, added: true}
]);
});
describe('anti-aliasing', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/diff/word.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('WordDiff', function() {

it('should diff multiple whitespace values', function() {
const diffResult = diffWordsWithSpace('New Value ', 'New ValueMoreData ');
expect(convertChangesToXML(diffResult)).to.equal('New<ins> ValueMoreData</ins> <del>Value </del>');
expect(convertChangesToXML(diffResult)).to.equal('New<del> Value</del> <ins>ValueMoreData </ins>');
});

it('should inserts values in parenthesis', function() {
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('WordDiff', function() {

it('should perform async operations', function(done) {
diffWordsWithSpace('New Value ', 'New ValueMoreData ', function(err, diffResult) {
expect(convertChangesToXML(diffResult)).to.equal('New<ins> ValueMoreData</ins> <del>Value </del>');
expect(convertChangesToXML(diffResult)).to.equal('New<del> Value</del> <ins>ValueMoreData </ins>');
done();
});
});
Expand Down

0 comments on commit 506a21b

Please sign in to comment.