Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
fix up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jun 22, 2015
1 parent b97c6be commit 673d160
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 50 deletions.
98 changes: 49 additions & 49 deletions test/custom-loader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ describe('Custom Loader', function () {

describe('scripts', function () {
if (typeof __karma__ == 'undefined' || __karma__.config.system.ie8)
it('should support ES6 scripts', function (done) {
customLoader['import']('test/loader/test.js')
.then(function (m) {
expect(m.loader).to.be.equal('custom');
})
.then(done, done)
it('should support ES6 scripts', function(done) {
customLoader['import']('test/loader/test.js')
.then(function (m) {
expect(m.loader).to.be.equal('custom');
})
.then(done, done)
});

it('should support AMD scripts', function (done) {
it('should support AMD scripts', function(done) {
customLoader['import']('test/loader/amd.js')
.then(function (m) {
expect(m.format).to.be.equal('amd');
})
.then(done, done);
.then(function (m) {
expect(m.format).to.be.equal('amd');
})
.then(done, done);
});
});

describe('special #locate path rule', function a() {

if (typeof __karma__ == 'undefined' || !__karma__.config.system.ie8)
it('should support special loading rules', function (done) {
it('should support special loading rules', function(done) {
customLoader['import']('path/custom.js')
.then(function (m) {
expect(m.path).to.be.ok();
})
.then(done, done);
.then(function (m) {
expect(m.path).to.be.ok();
})
.then(done, done);
});

});
Expand All @@ -43,60 +43,60 @@ describe('Custom Loader', function () {
}
var base = baseURL + 'test/loader/';

it('should make the normalize throw', function (done) {
it('should make the normalize throw', function(done) {
customLoader['import']('test/loader/error1-parent.js')
.then(supposeToFail, function (e) {
expect(e.toString()).to.contain('Error loading ' + base + 'error1-parent.js');
})
.then(done, done);
.then(supposeToFail, function(e) {
expect(e.toString()).to.contain('Error loading ' + base + 'error1-parent.js');
})
.then(done, done);
});

it('should make the locate throw', function (done) {
it('should make the locate throw', function(done) {
customLoader['import']('test/loader/error2')
.then(supposeToFail, function (e) {
expect(e.toString()).to.be.contain('Error loading ' + base + 'error2');
})
.then(done, done);
.then(supposeToFail, function(e) {
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.contain('Error loading ' + base + 'error2');
})
.then(done, done);
});

it('should make the fetch throw', function (done) {
it('should make the fetch throw', function(done) {
customLoader['import']('test/loader/error3')
.then(supposeToFail, function (e) {
expect(e.toString()).to.be.contain('Error loading ' + base + 'error3');
})
.then(done, done);
.then(supposeToFail, function(e) {
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.contain('Error loading ' + base + 'error3');
})
.then(done, done);
});

it('should make the translate throw', function (done) {
it('should make the translate throw', function(done) {
customLoader['import']('test/loader/error4')
.then(supposeToFail, function (e) {
expect(e.toString()).to.be.contain('Error loading ' + base + 'error4');
})
.then(done, done);
.then(supposeToFail, function(e) {
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.contain('Error loading ' + base + 'error4');
})
.then(done, done);
});

it('should make the instantiate throw', function (done) {
it('should make the instantiate throw', function(done) {
customLoader['import']('test/loader/error5')
.then(supposeToFail, function (e) {
expect(e.toString()).to.be.contain('Error loading ' + base + 'error5');
})
.then(done, done);
.then(supposeToFail, function(e) {
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.contain('Error loading ' + base + 'error5');
})
.then(done, done);
});

});

});

describe('#normalize', function () {
it('should support async normalization', function (done) {
it('should support async normalization', function(done) {
customLoader.normalize('asdfasdf')
.then(function (normalized) {
return customLoader['import'](normalized);
})
.then(function (m) {
expect(m.n).to.be.equal('n');
})
.then(done, done);
.then(function (normalized) {
return customLoader['import'](normalized);
})
.then(function (m) {
expect(m.n).to.be.equal('n');
})
.then(done, done);
});
});
});
2 changes: 1 addition & 1 deletion test/system.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ describe('System', function () {
System.import('test/loads/load-non-existent.js')
.then(supposedToFail)
.catch(function (e) {
expect(e).to.be.match(/Error loading \S+/);
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.match(/Error loading \S+/);
})
.then(done, done);
});
Expand Down

0 comments on commit 673d160

Please sign in to comment.