@@ -25,21 +25,9 @@ import (
2525 "github.com/tufin/oasdiff/load"
2626)
2727
28- func TestSuccessfulfilter_Run (t * testing.T ) {
28+ func TestSuccessfulFilter_Run (t * testing.T ) {
2929 fs := afero .NewMemMapFs ()
30- opts := & Opts {
31- basePath : "../../../test/data/base_spec.json" ,
32- outputPath : "foas.yaml" ,
33- fs : fs ,
34- }
35-
36- if err := opts .Run (); err != nil {
37- t .Fatalf ("Run() unexpected error: %v" , err )
38- }
39- }
4030
41- func TestFilterMulitplePreviewsRun (t * testing.T ) {
42- fs := afero .NewMemMapFs ()
4331 opts := & Opts {
4432 basePath : "../../../test/data/base_spec.json" ,
4533 outputPath : "filtered-oas.yaml" ,
@@ -51,12 +39,17 @@ func TestFilterMulitplePreviewsRun(t *testing.T) {
5139 t .Fatalf ("Run() unexpected error: %v" , err )
5240 }
5341
54- // private preview feature 1
55- info , err := loadRunResultOas (fs , "filtered-oas.yaml" )
42+ newSpec , err := loadRunResultOas (fs , opts .outputPath )
5643 require .NoError (t , err )
5744
58- // check all paths are kept
59- require .Len (t , info .Spec .Paths .Map (), 231 )
45+ // // check all paths are kept
46+ for _ , pathItem := range newSpec .Spec .Paths .Map () {
47+ // method
48+ for _ , operation := range pathItem .Operations () {
49+ // check extension is removed
50+ require .Nil (t , operation .Extensions )
51+ }
52+ }
6053}
6154
6255func TestOpts_PreRunE (t * testing.T ) {
@@ -96,13 +89,14 @@ func TestInvalidFormat_PreRun(t *testing.T) {
9689
9790 err := opts .PreRunE (nil )
9891 require .Error (t , err )
99- require .EqualError (t , err , "output format must be either 'json' or 'yaml ', got html" )
92+ require .EqualError (t , err , "format must be either 'json', 'yaml' or 'all ', got ' html' " )
10093}
10194
10295func TestInvalidPath_PreRun (t * testing.T ) {
10396 opts := & Opts {
10497 outputPath : "foas.html" ,
10598 basePath : "base.json" ,
99+ format : "all" ,
106100 }
107101
108102 err := opts .PreRunE (nil )
0 commit comments