You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
510 B

4 years ago
  1. var expect = require('chai').expect;
  2. describe('has-cors', function() {
  3. beforeEach(function() {
  4. // make sure result is not cached
  5. delete require.cache[require.resolve('./')];
  6. });
  7. it('should not have cors', function() {
  8. var hasCors = require('./');
  9. expect(hasCors).to.be.false;
  10. });
  11. it('should have cors', function() {
  12. global.XMLHttpRequest = function() {
  13. this.withCredentials = true;
  14. };
  15. var hasCors = require('./');
  16. expect(hasCors).to.be.true;
  17. });
  18. });