@@ -30,8 +30,8 @@ describe('spectral - test enabled rules - Swagger 2', function() {
3030 foundOtherValidator = true ;
3131 }
3232 } ) ;
33- // Since some spectral validations will result in errors, the exit code should equal 1
34- expect ( exitCode ) . toEqual ( 1 ) ;
33+
34+ expect ( exitCode ) . toEqual ( 0 ) ;
3535 expect ( foundOtherValidator ) . toBe ( false ) ;
3636
3737 consoleSpy . mockRestore ( ) ;
@@ -124,14 +124,12 @@ describe('spectral - test enabled rules - Swagger 2 In Memory', function() {
124124 defaultMode
125125 ) ;
126126
127- // should produce an object with `errors` and `warnings` keys that should
128- // both be non-empty
129- expect ( validationResults . errors . length ) . toBeGreaterThan ( 0 ) ;
127+ expect ( validationResults . errors . length ) . toEqual ( 0 ) ;
130128 expect ( validationResults . warnings . length ) . toBeGreaterThan ( 0 ) ;
131129
132130 errors = validationResults . errors . map ( error => error . message ) ;
133131 warnings = validationResults . warnings . map ( warn => warn . message ) ;
134- expect ( errors . length ) . toBeGreaterThan ( 0 ) ;
132+ expect ( errors . length ) . toEqual ( 0 ) ;
135133 expect ( warnings . length ) . toBeGreaterThan ( 0 ) ;
136134 } ) ;
137135
@@ -219,11 +217,11 @@ describe('spectral - test enabled rules - Swagger 2 In Memory', function() {
219217 ) ;
220218 } ) ;
221219
222- it ( 'test oas2-valid-example rule using mockFiles/swagger/enabled-rules-in-memory' , function ( ) {
223- expect ( errors ) . toContain (
220+ it ( 'test oas2-valid-definition- example rule using mockFiles/swagger/enabled-rules-in-memory' , function ( ) {
221+ expect ( errors ) . not . toContain (
224222 '`number_of_coins` property type should be integer'
225223 ) ;
226- expect ( warnings ) . not . toContain (
224+ expect ( warnings ) . toContain (
227225 '`number_of_coins` property type should be integer'
228226 ) ;
229227 } ) ;
@@ -273,8 +271,8 @@ describe('spectral - test enabled rules - OAS3', function() {
273271 foundOtherValidator = true ;
274272 }
275273 } ) ;
276- // Since some spectral validations will result in errors, the exit code should equal 1
277- expect ( exitCode ) . toEqual ( 1 ) ;
274+
275+ expect ( exitCode ) . toEqual ( 0 ) ;
278276 expect ( foundOtherValidator ) . toBe ( false ) ;
279277
280278 consoleSpy . mockRestore ( ) ;
@@ -336,11 +334,17 @@ describe('spectral - test enabled rules - OAS3', function() {
336334 ) ;
337335 } ) ;
338336
339- it ( 'test oas3-valid-example rule using mockFiles/oas3/enabled-rules.yml' , function ( ) {
337+ it ( 'test oas3-valid-schema- example rule using mockFiles/oas3/enabled-rules.yml' , function ( ) {
340338 expect ( allOutput ) . toContain (
341339 '`number_of_coins` property type should be integer'
342340 ) ;
343341 } ) ;
342+
343+ it ( 'test oas3-valid-oas-content-example rule using mockFiles/oas3/enabled-rules.yml' , function ( ) {
344+ expect ( allOutput ) . toContain (
345+ '`number_of_connectors` property should be equal to one of the allowed values: 1, 2, a_string, 8'
346+ ) ;
347+ } ) ;
344348} ) ;
345349
346350describe ( 'spectral - test enabled rules - OAS3 In Memory' , function ( ) {
@@ -352,14 +356,13 @@ describe('spectral - test enabled rules - OAS3 In Memory', function() {
352356 const defaultMode = true ;
353357 const validationResults = await inCodeValidator ( oas3InMemory , defaultMode ) ;
354358
355- // should produce an object with `errors` and `warnings` keys that should
356- // both be non-empty
357- expect ( validationResults . errors . length ) . toBeGreaterThan ( 0 ) ;
359+ // should produce an object with an empty `errors` key and a non-empty `warnings` key
360+ expect ( validationResults . errors . length ) . toEqual ( 0 ) ;
358361 expect ( validationResults . warnings . length ) . toBeGreaterThan ( 0 ) ;
359362
360363 errors = validationResults . errors . map ( error => error . message ) ;
361364 warnings = validationResults . warnings . map ( warn => warn . message ) ;
362- expect ( errors . length ) . toBeGreaterThan ( 0 ) ;
365+ expect ( errors . length ) . toEqual ( 0 ) ;
363366 expect ( warnings . length ) . toBeGreaterThan ( 0 ) ;
364367 } ) ;
365368
@@ -448,10 +451,10 @@ describe('spectral - test enabled rules - OAS3 In Memory', function() {
448451 } ) ;
449452
450453 it ( 'test oas3-valid-example rule using mockFiles/oas3/enabled-rules-in-memory' , function ( ) {
451- expect ( errors ) . toContain (
454+ expect ( errors ) . not . toContain (
452455 '`number_of_coins` property type should be integer'
453456 ) ;
454- expect ( warnings ) . not . toContain (
457+ expect ( warnings ) . toContain (
455458 '`number_of_coins` property type should be integer'
456459 ) ;
457460 } ) ;
0 commit comments