2
0
Fork 0
es5-ff-spa-loader/test/spec/test-cache.js

43 lines
1 KiB
JavaScript
Raw Normal View History

define(['es5-ff-spa-loader'], function(FFSpaLoader) {
'use strict';
describe('Test Cache', function() {
beforeEach(function() {
jasmine.Ajax.install();
});
afterEach(function() {
jasmine.Ajax.uninstall();
});
it('FFSpaLoader boot ', function(done) {
var clientResource = {
data: {
resources: [{
url: '/static/js/foobar.js',
type: 'js',
hash: 12381273
}]
}
};
jasmine.Ajax.stubRequest('http://localhost:999/static/spa-client-resources').andReturn({
'responseText': JSON.stringify(clientResource)
});
jasmine.Ajax.stubRequest('http://localhost:999/static/js/foobar.js').andReturn({
'responseText': '\nvar FOOBAR = \'loaded\';\n'
});
//FFSpaLoader.options.boot.debug.enable = true;
FFSpaLoader.options.server.url = 'http://localhost:999';
FFSpaLoader.options.server.assets = '/static/spa-client-resources';
FFSpaLoader.start(function(err) {
if (err !== null) {
fail();
} else {
done();
}
});
});
});
});