test.js 510 B

123456789101112131415161718192021222324
  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. });