2
Fork 0

wip: made karma test running

This commit is contained in:
Willem 2016-04-22 10:34:11 +02:00
parent eff1b95b32
commit 3e1ddaf6eb
15 changed files with 360 additions and 99 deletions

33
test/spec/test-boot.js Normal file
View file

@ -0,0 +1,33 @@
'use strict';
define(['es5-ff-spa-loader'], function(FFSpaLoader) {
describe('Start loader', function() {
it('FFSpaLoader start with error', function(done) {
FFSpaLoader.options.server.url = 'http://localhost:9999';
FFSpaLoader.options.error.handler = function(err) {
done();
};
FFSpaLoader.start();
});
it('FFSpaLoader starts', function(done) {
FFSpaLoader.options.server.url = 'http://localhost:9090/test';
FFSpaLoader.options.server.assets = '/static/spa-client-resources';
FFSpaLoader.options.error.handler = function(err) {
fail(); // TIODI
};
FFSpaLoader.start(function() {
done();
});
});
it('FFSpaLoader starts again', function(done) {
FFSpaLoader.options.server.url = 'http://localhost:9090/test';
FFSpaLoader.options.server.assets = '/static/spa-client-resources';
FFSpaLoader.options.error.handler = function(err) {
fail(); // TIODI
};
FFSpaLoader.start(function() {
done();
});
});
});
});

37
test/spec/test-exports.js Normal file
View file

@ -0,0 +1,37 @@
'use strict';
define(['es5-ff-spa-loader'], function(FFSpaLoader) {
describe('Check module exports', function() {
describe('Check undefined', function() {
it('FFSpaLoader.options should be defined', function() {
expect(FFSpaLoader.options === undefined).toEqual(false);
});
it('FFSpaLoader.factory should be defined', function() {
expect(FFSpaLoader.factory === undefined).toEqual(false);
});
it('FFSpaLoader.start should be defined', function() {
expect(FFSpaLoader.start === undefined).toEqual(false);
});
it('FFSpaLoader.clearServerUrl should be defined', function() {
expect(FFSpaLoader.clearServerUrl === undefined).toEqual(false);
});
it('FFSpaLoader.clearCache should be defined', function() {
expect(FFSpaLoader.clearCache === undefined).toEqual(false);
});
});
describe('Check function', function() {
it('FFSpaLoader.start should be function', function() {
expect(typeof FFSpaLoader.start === 'function').toEqual(true);
});
it('FFSpaLoader.clearServerUrl should be function', function() {
expect(typeof FFSpaLoader.clearServerUrl === 'function').toEqual(true);
});
it('FFSpaLoader.clearCache should be function', function() {
expect(typeof FFSpaLoader.clearCache === 'function').toEqual(true);
});
});
});
});

21
test/spec/test-factory.js Normal file
View file

@ -0,0 +1,21 @@
'use strict';
define(['es5-ff-spa-loader'], function(FFSpaLoader) {
describe('Check factory detect', function() {
it('FFSpaLoader.factory.detect.localStorage', function() {
expect(FFSpaLoader.factory.detect.localStorage()).toEqual(true);
});
it('FFSpaLoader.factory.detect.openDatabase', function() {
expect(FFSpaLoader.factory.detect.openDatabase()).toEqual(true);
});
it('FFSpaLoader.factory.detect.sqlitePlugin', function() {
expect(FFSpaLoader.factory.detect.sqlitePlugin()).toEqual(false);
});
it('FFSpaLoader.factory.detect.cordova', function() {
expect(FFSpaLoader.factory.detect.cordova()).toEqual(false);
});
it('FFSpaLoader.factory.detect.cordovaDevice', function() {
expect(FFSpaLoader.factory.detect.cordovaDevice()).toEqual(false);
});
});
});