diff --git a/src/test/patch.spec.ts b/src/test/patch.spec.ts index 736381b..55b948c 100644 --- a/src/test/patch.spec.ts +++ b/src/test/patch.spec.ts @@ -19,7 +19,7 @@ describe('Get Patch', () => { type: 'add', oldPos, newPos, - items: str.split(''), + items: [...str], }; } function remove(oldPos: number, newPos: number, str: string): es.PatchItem { @@ -27,11 +27,11 @@ describe('Get Patch', () => { type: 'remove', oldPos, newPos, - items: str.split(''), + items: [...str], }; } function es_str(a: string, b: string, script: es.Patch, msg?: string) { - assert.deepStrictEqual(es.getPatch(a.split(''), b.split('')), script, msg); + assert.deepStrictEqual(es.getPatch([...a], [...b]), script, msg); } es_str('', '', [], 'empty'); @@ -103,5 +103,7 @@ describe('Get Patch', () => { [add(12, 12, '12345678901234567890')], 'remove 12345678901234567890', ); + + es_str('💢💩💧', '💢💫💧', [remove(1, 1, '💩'), add(2, 1, '💫')], 'works with unicodes'); }); }); diff --git a/tsconfig.json b/tsconfig.json index 6f10aea..cfa6a36 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "declaration": true, "outDir": "./dist", "strict": true, - "esModuleInterop": true + "esModuleInterop": true, + "downlevelIteration": true } }