mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
494d817314
* Change syntax to see if build passes * Test commit * Test with node 10 * Test adding all browsers in travis * remove other browsers when running on travis
18 lines
644 B
JavaScript
18 lines
644 B
JavaScript
var isURLSameOrigin = require('../../../lib/helpers/isURLSameOrigin');
|
|
|
|
describe('helpers::isURLSameOrigin', function () {
|
|
it('should detect same origin', function () {
|
|
expect(isURLSameOrigin(window.location.href)).toEqual(true);
|
|
});
|
|
|
|
it('should detect different origin', function () {
|
|
expect(isURLSameOrigin('https://github.com/axios/axios')).toEqual(false);
|
|
});
|
|
|
|
it('should detect XSS scripts on a same origin request', function () {
|
|
expect(function() {
|
|
isURLSameOrigin('https://github.com/axios/axios?<script>alert("hello")</script>');
|
|
}).toThrowError(Error, 'URL contains XSS injection attempt')
|
|
});
|
|
});
|