Skip to content

Commit abf33f8

Browse files
Changed a CORS test to pass on browsers that don't support CORS
1 parent 091f01b commit abf33f8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/specs/cors/cors.spec.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,20 @@ describe('CORS support', function() {
4343
.parse('http://petstore.swagger.io:80/v2/swagger.json', {
4444
http: { withCredentials: true }
4545
})
46-
.then(helper.shouldNotGetCalled)
4746
.catch(function(err) {
47+
// The request failed, which is expected
4848
expect(err.message).to.contain('Error downloading file');
49-
49+
})
50+
.then(function(schema) {
51+
// The request succeeded, which means this browser doesn't support CORS.
52+
expect(schema).to.be.an('object');
53+
expect(schema).not.to.be.empty;
54+
expect(parser.schema).to.equal(schema);
55+
})
56+
.then(function() {
5057
// Restore the original error handler
5158
global.onerror = oldOnError;
52-
});
59+
})
5360
});
5461
}
5562
});

0 commit comments

Comments
 (0)