@@ -3,7 +3,7 @@ import fs from 'fs';
33import path from 'path' ;
44import { fileURLToPath } from 'url' ;
55import { dirname } from 'path' ;
6- import { chooseFormat } from '../src/formatters/index.js' ;
6+ import genDiff from '../src/formatters/index.js' ;
77
88const __filename = fileURLToPath ( import . meta. url ) ;
99const __dirname = dirname ( __filename ) ;
@@ -18,29 +18,25 @@ const expectFormatPlain = readFile('expectDiffFormatPlain.txt');
1818const expectFormatStylish = readFile ( 'expectDiffFormatStylish.txt' ) ;
1919
2020test ( 'compareFilesJsonFormatStylish' , ( ) => {
21- expect (
22- chooseFormat ( '__fixtures__/file1.json' , '__fixtures__/file2.json' )
23- ) . toEqual ( expectFormatStylish ) ;
21+ expect ( genDiff ( '__fixtures__/file1.json' , '__fixtures__/file2.json' ) ) . toEqual (
22+ expectFormatStylish
23+ ) ;
2424} ) ;
2525
2626test ( 'compareFilesYamlFormatStylish' , ( ) => {
2727 expect (
28- chooseFormat (
29- '__fixtures__/file1.yaml' ,
30- '__fixtures__/file2.yaml' ,
31- 'stylish'
32- )
28+ genDiff ( '__fixtures__/file1.yaml' , '__fixtures__/file2.yaml' , 'stylish' )
3329 ) . toEqual ( expectFormatStylish ) ;
3430} ) ;
3531
3632test ( 'compareFilesJsonFormatPlain' , ( ) => {
3733 expect (
38- chooseFormat ( '__fixtures__/file1.yaml' , '__fixtures__/file2.json' , 'plain' )
34+ genDiff ( '__fixtures__/file1.yaml' , '__fixtures__/file2.json' , 'plain' )
3935 ) . toEqual ( expectFormatPlain ) ;
4036} ) ;
4137
4238test ( 'compareFilesFormatJson' , ( ) => {
4339 expect (
44- chooseFormat ( '__fixtures__/file1.yaml' , '__fixtures__/file2.yaml' , 'json' )
40+ genDiff ( '__fixtures__/file1.yaml' , '__fixtures__/file2.yaml' , 'json' )
4541 ) . toEqual ( expectFormatJson ) ;
4642} ) ;
0 commit comments