Skip to content

Commit 86c71bb

Browse files
committed
Fixing tests
1 parent 481a0a4 commit 86c71bb

File tree

1 file changed

+89
-125
lines changed

1 file changed

+89
-125
lines changed

test/compute-lines-test.ts

Lines changed: 89 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -200,75 +200,75 @@ describe('Testing compute lines utils', (): void => {
200200
});
201201

202202
it('Should call "diffChars" jsDiff method when compareMethod is not provided', (): void => {
203-
const oldCode = `Hello World`;
203+
const oldCode = 'Hello World';
204204
const newCode = `My Updated Name
205205
Also this info`;
206206

207207
expect(computeLineInformation(oldCode, newCode))
208208
.toMatchObject({
209209
lineInformation: [
210210
{
211-
"right": {
212-
"lineNumber": 1,
213-
"type": 1,
214-
"value": [
211+
right: {
212+
lineNumber: 1,
213+
type: 1,
214+
value: [
215215
{
216-
"type": 1,
217-
"value": "My Updat"
216+
type: 1,
217+
value: 'My Updat',
218218
},
219219
{
220-
"type": 0,
221-
"value": "e"
220+
type: 0,
221+
value: 'e',
222222
},
223223
{
224-
"type": 1,
225-
"value": "d"
224+
type: 1,
225+
value: 'd',
226226
},
227227
{
228-
"type": 0,
229-
"value": " "
228+
type: 0,
229+
value: ' ',
230230
},
231231
{
232-
"type": 1,
233-
"value": "Name"
234-
}
235-
]
232+
type: 1,
233+
value: 'Name',
234+
},
235+
],
236236
},
237-
"left": {
238-
"lineNumber": 1,
239-
"type": 2,
240-
"value": [
237+
left: {
238+
lineNumber: 1,
239+
type: 2,
240+
value: [
241241
{
242-
"type": 2,
243-
"value": "H"
242+
type: 2,
243+
value: 'H',
244244
},
245245
{
246-
"type": 0,
247-
"value": "e"
246+
type: 0,
247+
value: 'e',
248248
},
249249
{
250-
"type": 2,
251-
"value": "llo"
250+
type: 2,
251+
value: 'llo',
252252
},
253253
{
254-
"type": 0,
255-
"value": " "
254+
type: 0,
255+
value: ' ',
256256
},
257257
{
258-
"type": 2,
259-
"value": "World"
260-
}
261-
]
262-
}
258+
type: 2,
259+
value: 'World',
260+
},
261+
],
262+
},
263263
},
264264
{
265-
"right": {
266-
"lineNumber": 2,
267-
"type": 1,
268-
"value": "Also this info"
265+
right: {
266+
lineNumber: 2,
267+
type: 1,
268+
value: 'Also this info',
269269
},
270-
"left": {}
271-
}
270+
left: {},
271+
},
272272
],
273273
diffLines: [
274274
0,
@@ -278,135 +278,99 @@ Also this info`;
278278
});
279279

280280
it('Should call "diffWords" jsDiff method when a compareMethod IS provided', (): void => {
281-
const oldCode = `Hello World`;
281+
const oldCode = 'Hello World';
282282
const newCode = `My Updated Name
283283
Also this info`;
284284

285285
expect(computeLineInformation(oldCode, newCode, false, DiffMethod.WORDS))
286286
.toMatchObject({
287287
lineInformation: [
288288
{
289-
"right": {
290-
"lineNumber": 1,
291-
"type": 1,
292-
"value": [
289+
right: {
290+
lineNumber: 1,
291+
type: 1,
292+
value: [
293293
{
294-
"type": 1,
295-
"value": "My"
294+
type: 1,
295+
value: 'My',
296296
},
297297
{
298-
"type": 0,
299-
"value": " "
298+
type: 0,
299+
value: ' ',
300300
},
301301
{
302-
"type": 1,
303-
"value": "Updated Name"
304-
}
305-
]
302+
type: 1,
303+
value: 'Updated Name',
304+
},
305+
],
306306
},
307-
"left": {
308-
"lineNumber": 1,
309-
"type": 2,
310-
"value": [
307+
left: {
308+
lineNumber: 1,
309+
type: 2,
310+
value: [
311311
{
312-
"type": 2,
313-
"value": "Hello"
312+
type: 2,
313+
value: 'Hello',
314314
},
315315
{
316-
"type": 0,
317-
"value": " "
316+
type: 0,
317+
value: ' ',
318318
},
319319
{
320-
"type": 2,
321-
"value": "World"
322-
}
323-
]
324-
}
325-
},
326-
{
327-
"right": {
328-
"lineNumber": 2,
329-
"type": 1,
330-
"value": "Also this info"
331-
},
332-
"left": {}
333-
}
334-
],
335-
diffLines: [
336-
0,
337-
2
338-
],
339-
});
340-
});
341-
342-
it('Should not call jsDiff method and not diff text when unknown JsDiffMethod is passed', (): void => {
343-
const oldCode = `Hello World`;
344-
const newCode = `My Updated Name
345-
Also this info`;
346-
347-
expect(computeLineInformation(oldCode, newCode, false, 'unknownMethod'))
348-
.toMatchObject({
349-
lineInformation: [
350-
{
351-
"right": {
352-
"lineNumber": 1,
353-
"type": 1,
354-
"value": "My Updated Name"
320+
type: 2,
321+
value: 'World',
322+
},
323+
],
355324
},
356-
"left": {
357-
"lineNumber": 1,
358-
"type": 2,
359-
"value": "Hello World"
360-
}
361325
},
362326
{
363-
"right": {
364-
"lineNumber": 2,
365-
"type": 1,
366-
"value": "Also this info"
327+
right: {
328+
lineNumber: 2,
329+
type: 1,
330+
value: 'Also this info',
367331
},
368-
"left": {}
369-
}
332+
left: {},
333+
},
370334
],
371335
diffLines: [
372336
0,
373-
2
337+
2,
374338
],
375339
});
376340
});
377341

378342
it('Should not call jsDiff method and not diff text when disableWordDiff is true', (): void => {
379-
const oldCode = `Hello World`;
343+
const oldCode = 'Hello World';
380344
const newCode = `My Updated Name
381345
Also this info`;
382346

383347
expect(computeLineInformation(oldCode, newCode, true))
384348
.toMatchObject({
385349
lineInformation: [
386350
{
387-
"right": {
388-
"lineNumber": 1,
389-
"type": 1,
390-
"value": "My Updated Name"
351+
right: {
352+
lineNumber: 1,
353+
type: 1,
354+
value: 'My Updated Name',
355+
},
356+
left: {
357+
lineNumber: 1,
358+
type: 2,
359+
value: 'Hello World',
391360
},
392-
"left": {
393-
"lineNumber": 1,
394-
"type": 2,
395-
"value": "Hello World"
396-
}
397361
},
398362
{
399-
"right": {
400-
"lineNumber": 2,
401-
"type": 1,
402-
"value": "Also this info"
363+
right: {
364+
lineNumber: 2,
365+
type: 1,
366+
value: 'Also this info',
403367
},
404-
"left": {}
405-
}
368+
left: {},
369+
},
406370
],
407371
diffLines: [
408372
0,
409-
2
373+
2,
410374
],
411375
});
412376
});

0 commit comments

Comments
 (0)