forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
diffStringsRaw.test.ts
34 lines (29 loc) 路 1 KB
/
diffStringsRaw.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, diffStringsRaw} from '../';
describe('diffStringsRaw', () => {
test('one-line with cleanup', () => {
const expected: Array<Diff> = [
new Diff(DIFF_EQUAL, 'change '),
new Diff(DIFF_DELETE, 'from'),
new Diff(DIFF_INSERT, 'to'),
];
const received = diffStringsRaw('change from', 'change to', true);
expect(received).toEqual(expected);
});
test('one-line without cleanup', () => {
const expected: Array<Diff> = [
new Diff(DIFF_EQUAL, 'change '),
new Diff(DIFF_DELETE, 'fr'),
new Diff(DIFF_INSERT, 't'),
new Diff(DIFF_EQUAL, 'o'),
new Diff(DIFF_DELETE, 'm'),
];
const received = diffStringsRaw('change from', 'change to', false);
expect(received).toEqual(expected);
});
});