@@ -3,6 +3,8 @@ import fs from 'fs';
33import path from 'path' ;
44import genDiff from '../src/index.js' ;
55import parseFile from '../src/parsers.js' ;
6+ import stylish from '../src/formatters/stylish.js' ;
7+ import plain from '../src/formatters/plain.js' ;
68
79const __filename = fileURLToPath ( import . meta. url ) ;
810const __dirname = path . dirname ( __filename ) ;
@@ -58,7 +60,23 @@ describe('empty files', () => {
5860} ) ;
5961
6062describe ( 'parsers' , ( ) => {
61- test ( 'parse invalid extension' , ( ) => {
63+ test ( 'parse invalid file extension' , ( ) => {
6264 expect ( ( ) => parseFile ( { key : 'value' } , '.txt' ) ) . toThrow ( ) ;
6365 } ) ;
6466} ) ;
67+
68+ describe ( 'formatters when dealing with unsupported types' , ( ) => {
69+ test ( 'stylish' , ( ) => {
70+ expect ( ( ) => stylish ( [
71+ { key : 'value' , type : 'added' } ,
72+ { key : 'value' , type : 'complex' } ,
73+ ] ) ) . toThrow ( ) ;
74+ } ) ;
75+
76+ test ( 'plain' , ( ) => {
77+ expect ( ( ) => plain ( [
78+ { key : 'value' , type : 'unchanged' } ,
79+ { key : 'value' , type : 'complex' } ,
80+ ] ) ) . toThrow ( ) ;
81+ } ) ;
82+ } ) ;
0 commit comments