-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/RomanGotsiy/json-schema-r…
…ef-parser into pull-requests/5 # Conflicts: # dist/ref-parser.js # dist/ref-parser.js.map # dist/ref-parser.min.js # dist/ref-parser.min.js.map
- Loading branch information
Showing
9 changed files
with
625 additions
and
680 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
|
||
describe('parse from CORS with Access-Control-Allow-Origin: *', function() { | ||
var windowOnError, testDone; | ||
|
||
beforeEach(function() { | ||
windowOnError = global.onerror; | ||
global.onerror = function() { | ||
testDone(); | ||
return true; | ||
} | ||
}); | ||
|
||
afterEach(function() { | ||
global.onerror = windowOnError; | ||
}); | ||
|
||
it('should parse successfully with http.withCredentials = false', function() { | ||
var parser = new $RefParser(); | ||
return parser | ||
.parse('http://petstore.swagger.io:80/v2/swagger.json', { | ||
http: { withCredentials: false } | ||
}) | ||
.then(function(schema) { | ||
expect(schema).to.be.an('object'); | ||
expect(schema).not.to.be.empty; | ||
expect(parser.schema).to.equal(schema); | ||
}); | ||
}); | ||
|
||
if (userAgent.isBrowser) { | ||
it('should throw error in browser if http.withCredentials = true (default)', function(done) { | ||
testDone = done; | ||
var parser = new $RefParser(); | ||
return parser | ||
.parse('http://petstore.swagger.io:80/v2/swagger.json', { | ||
http: { withCredentials: true } | ||
}) | ||
.then(helper.shouldNotGetCalled) | ||
.catch(function(err) { | ||
expect(err.message).to.contain('Error downloading file'); | ||
done(); | ||
}); | ||
}); | ||
} | ||
}); |