@@ -9,12 +9,22 @@ import {
99 YAMLNonbreakingChanges ,
1010 YAMLOutputDiff ,
1111 YAMLUnclassifiedChanges ,
12+ MarkdownBreakingChanges ,
13+ MarkdownNonbreakingChanges ,
14+ MarkdownOutputDiff ,
15+ MarkdownUnclassifiedChanges ,
16+ MarkdownJSONSubtypeChanges ,
17+ MarkdownYAMLSubtypeChanges ,
1218} from './fixtures/asyncapidiff.fixtures' ;
1319
20+ import {
21+ diffOutput
22+ } from './fixtures/main.fixtures' ;
23+
1424describe ( 'AsyncAPIDiff wrapper' , ( ) => {
1525 test ( 'checks the instance' , ( ) => {
1626 expect (
17- new AsyncAPIDiff ( JSON . stringify ( inputDiff ) , { outputType : 'json' } )
27+ new AsyncAPIDiff ( JSON . stringify ( inputDiff ) , { outputType : 'json' } )
1828 ) . toBeInstanceOf ( AsyncAPIDiff ) ;
1929 } ) ;
2030
@@ -73,4 +83,47 @@ describe('AsyncAPIDiff wrapper', () => {
7383 } ) ;
7484 expect ( diff . unclassified ( ) ) . toEqual ( YAMLUnclassifiedChanges ) ;
7585 } ) ;
86+
87+ test ( 'Markdown: returns the original full output' , ( ) => {
88+ const diff = new AsyncAPIDiff ( JSON . stringify ( inputDiff ) , {
89+ outputType : 'markdown' ,
90+ } ) ;
91+ expect ( diff . getOutput ( ) ) . toEqual ( MarkdownOutputDiff ) ;
92+ } ) ;
93+
94+ test ( 'Markdown: returns breaking changes' , ( ) => {
95+ const diff = new AsyncAPIDiff ( JSON . stringify ( inputDiff ) , {
96+ outputType : 'markdown' ,
97+ } ) ;
98+ expect ( diff . breaking ( ) ) . toEqual ( MarkdownBreakingChanges ) ;
99+ } ) ;
100+
101+ test ( 'Markdown: returns non-breaking changes' , ( ) => {
102+ const diff = new AsyncAPIDiff ( JSON . stringify ( inputDiff ) , {
103+ outputType : 'markdown' ,
104+ } ) ;
105+ expect ( diff . nonBreaking ( ) ) . toEqual ( MarkdownNonbreakingChanges ) ;
106+ } ) ;
107+
108+ test ( 'Markdown: returns unclassified changes' , ( ) => {
109+ const diff = new AsyncAPIDiff ( JSON . stringify ( inputDiff ) , {
110+ outputType : 'markdown' ,
111+ } ) ;
112+ expect ( diff . unclassified ( ) ) . toEqual ( MarkdownUnclassifiedChanges ) ;
113+ } ) ;
114+
115+ test ( 'Markdown: returns changes using subtype JSON as the default' , ( ) => {
116+ const diff = new AsyncAPIDiff ( JSON . stringify ( diffOutput ) , {
117+ outputType : 'markdown' ,
118+ } ) ;
119+ expect ( diff . getOutput ( ) ) . toEqual ( MarkdownJSONSubtypeChanges ) ;
120+ } ) ;
121+
122+ test ( 'Markdown: returns changes using subtype YAML' , ( ) => {
123+ const diff = new AsyncAPIDiff ( JSON . stringify ( diffOutput ) , {
124+ outputType : 'markdown' ,
125+ markdownSubtype : 'yaml' ,
126+ } ) ;
127+ expect ( diff . getOutput ( ) ) . toEqual ( MarkdownYAMLSubtypeChanges ) ;
128+ } ) ;
76129} ) ;
0 commit comments