@@ -9,12 +9,22 @@ import {
9
9
YAMLNonbreakingChanges ,
10
10
YAMLOutputDiff ,
11
11
YAMLUnclassifiedChanges ,
12
+ MarkdownBreakingChanges ,
13
+ MarkdownNonbreakingChanges ,
14
+ MarkdownOutputDiff ,
15
+ MarkdownUnclassifiedChanges ,
16
+ MarkdownJSONSubtypeChanges ,
17
+ MarkdownYAMLSubtypeChanges ,
12
18
} from './fixtures/asyncapidiff.fixtures' ;
13
19
20
+ import {
21
+ diffOutput
22
+ } from './fixtures/main.fixtures' ;
23
+
14
24
describe ( 'AsyncAPIDiff wrapper' , ( ) => {
15
25
test ( 'checks the instance' , ( ) => {
16
26
expect (
17
- new AsyncAPIDiff ( JSON . stringify ( inputDiff ) , { outputType : 'json' } )
27
+ new AsyncAPIDiff ( JSON . stringify ( inputDiff ) , { outputType : 'json' } )
18
28
) . toBeInstanceOf ( AsyncAPIDiff ) ;
19
29
} ) ;
20
30
@@ -73,4 +83,47 @@ describe('AsyncAPIDiff wrapper', () => {
73
83
} ) ;
74
84
expect ( diff . unclassified ( ) ) . toEqual ( YAMLUnclassifiedChanges ) ;
75
85
} ) ;
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
+ } ) ;
76
129
} ) ;
0 commit comments