Skip to content

Commit

Permalink
Merge branch 'add-travis-ci' into make-check-automatic
Browse files Browse the repository at this point in the history
  • Loading branch information
rars committed May 1, 2017
2 parents de02c7e + a5d644a commit 50672ae
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- "6"
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install
3 changes: 2 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module.exports = function (config) {
config.set({
plugins: [
'karma-jasmine',
'karma-chrome-launcher'
'karma-chrome-launcher',
'karma-firefox-launcher'
],
frameworks: ['jasmine'],
singleRun: false,
Expand Down
36 changes: 34 additions & 2 deletions test/angular-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ describe('Test environment provider', function () {
theEnvServiceProvider.config({
domains: {
development: ['localhost'],
production: ['app.*.com']
production: ['app.*.com', 'app.web.co.uk']
},
vars: {
development: {
backend: 'https://backend-dev/'
backend: 'https://backend-dev/',
authServiceUrl: 'https://auth-server-dev/'
},
production: {
backend: 'https://backend/'
},
defaults: {
authServiceUrl: 'https://auth-server/'
}
}
});
Expand Down Expand Up @@ -71,6 +75,34 @@ describe('Test environment provider', function () {
envService.set('production');
expect(envService.read('backend')).toBe('https://backend/');
});

it('tests the correct environment is identified by name using is method', function () {
expect(envService.is('development')).toBe(true);
expect(envService.is('production')).toBe(false);
envService.set('production');
expect(envService.is('development')).toBe(false);
expect(envService.is('production')).toBe(true);
});

(function () {
var i = 0, args = [undefined, '', 'all'];

for (i = 0; i < args.length; i++) {
it('tests all config is returned if read(' + args[i] + ') is called', function () {
var config = envService.read(args[i]);
expect(Object.keys(config).length).toBe(2);
expect(config.authServiceUrl).toBe('https://auth-server-dev/');
expect(config.backend).toBe('https://backend-dev/');
});
}
})();

it('tests default value should be chosen from config if value is undefined for the environment',
function () {
expect(envService.read('authServiceUrl')).toBe('https://auth-server-dev/');
envService.set('production');
expect(envService.read('authServiceUrl')).toBe('https://auth-server/');
});
});

describe('tests matching domains', function () {
Expand Down

0 comments on commit 50672ae

Please sign in to comment.