2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-14 18:42:33 +03:00
Files
axios/test/specs/helpers/isURLSameOrigin.spec.js
T
Yasu Flores 494d817314 Change syntax to see if build passes (#2488)
* 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
2019-10-25 11:25:53 -03:00

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')
});
});