From b351b9678214d0c30e7126fb0bc6138d645ca70f Mon Sep 17 00:00:00 2001 From: Mark Amery Date: Mon, 8 Jan 2024 14:57:18 +0000 Subject: [PATCH] Add test (which fails; needs changes from https://github.com/kpdecker/jsdiff/pull/439) --- test/diff/character.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/diff/character.js b/test/diff/character.js index 9061e69be..713a3d491 100644 --- a/test/diff/character.js +++ b/test/diff/character.js @@ -6,8 +6,16 @@ import {expect} from 'chai'; describe('diff/character', function() { describe('#diffChars', function() { it('Should diff chars', function() { - const diffResult = diffChars('New Value.', 'New ValueMoreData.'); - expect(convertChangesToXML(diffResult)).to.equal('New ValueMoreData.'); + const diffResult = diffChars('Old Value.', 'New ValueMoreData.'); + expect(convertChangesToXML(diffResult)).to.equal('OldNew ValueMoreData.'); + }); + + describe('oneChangePerToken option', function() { + it('emits one change per token', function() { + const diffResult = diffChars('Old Value.', 'New ValueMoreData.', {oneChangePerToken: true}); + expect(diffResult.length).to.equal(21); + expect(convertChangesToXML(diffResult)).to.equal('OldNew ValueMoreData.'); + }); }); describe('case insensitivity', function() {