Fixed ngXosLib tests
diff --git a/views/ngXosLib/karma.conf.js b/views/ngXosLib/karma.conf.js
index 803ebb1..d4137a0 100644
--- a/views/ngXosLib/karma.conf.js
+++ b/views/ngXosLib/karma.conf.js
@@ -11,7 +11,14 @@
return path.relative(process.cwd(), file);
});
-console.log('bower', bowerComponents)
+var files = bowerComponents.concat([
+ 'api/**/*.js',
+ 'xosHelpers/src/*.module.js',
+ 'xosHelpers/src/**/*.js',
+ 'xosHelpers/spec/**/*.test.js'
+]);
+
+console.log('files', files)
module.exports = function(config) {
/*eslint-enable*/
@@ -27,12 +34,7 @@
// list of files / patterns to load in the browser
- files: bowerComponents.concat([
- //'./api/**/*.js',
- './xosHelpers/src/*.module.js',
- //'./xosHelpers/src/**/*.js',
- './xosHelpers/spec/**/*.test.js'
- ]),
+ files: files,
// list of files to exclude
@@ -86,7 +88,7 @@
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
- browsers: ['PhantomJS'],
+ browsers: ['PhantomJS', 'Chrome'],
// Continuous Integration mode
diff --git a/views/ngXosLib/package.json b/views/ngXosLib/package.json
index 8ae1e6e..b2d092d 100644
--- a/views/ngXosLib/package.json
+++ b/views/ngXosLib/package.json
@@ -32,6 +32,7 @@
"jasmine-core": "^2.4.1",
"karma": "^0.13.19",
"karma-babel-preprocessor": "^6.0.1",
+ "karma-chrome-launcher": "^0.2.3",
"karma-jasmine": "^0.3.6",
"karma-mocha-reporter": "^1.1.3",
"karma-ng-html2js-preprocessor": "^0.2.0",
diff --git a/views/ngXosLib/xosHelpers/spec/csrftoken.test.js b/views/ngXosLib/xosHelpers/spec/csrftoken.test.js
index 60e8c63..443034d 100644
--- a/views/ngXosLib/xosHelpers/spec/csrftoken.test.js
+++ b/views/ngXosLib/xosHelpers/spec/csrftoken.test.js
@@ -2,21 +2,33 @@
describe('The xos.helper module', function(){
var SetCSRFToken, httpProviderObj;
- beforeEach(module('xos.helpers'));
+ //beforeEach(module('xos.helpers'));
+ //
+ //beforeEach(inject(function($httpProvider){
+ // httpProviderObj = $httpProvider;
+ //}));
+ //
+ //beforeEach(inject(function(_SetCSRFToken_){
+ // console.log('inject csrf');
+ // SetCSRFToken = _SetCSRFToken_;
+ //}));
- beforeEach(module(function(_$httpProvider_){
- httpProviderObj = _$httpProvider_;
- }));
+ beforeEach(function() {
+ module('xos.helpers', function ($httpProvider) {
+ //save our interceptor
+ httpProviderObj = $httpProvider;
+ });
- beforeEach(angular.mock.inject(function(_SetCSRFToken_){
- SetCSRFToken = _SetCSRFToken_;
- }));
+ inject(function (_SetCSRFToken_) {
+ SetCSRFToken = _SetCSRFToken_;
+ })
+ });
it('should exist', () => {
expect(SetCSRFToken).toBeDefined();
});
- xit('should set SetCSRFToken interceptor', () => {
+ it('should set SetCSRFToken interceptor', () => {
expect(httpProviderObj).toBeDefined();
expect(httpProviderObj.interceptors).toContain('SetCSRFToken');
});
diff --git a/views/ngXosLib/xosHelpers/src/xosHelpers.module.js b/views/ngXosLib/xosHelpers/src/xosHelpers.module.js
index 7c97de0..abbf012 100644
--- a/views/ngXosLib/xosHelpers/src/xosHelpers.module.js
+++ b/views/ngXosLib/xosHelpers/src/xosHelpers.module.js
@@ -15,6 +15,7 @@
angular
.module('xos.helpers',[
'ngCookies',
+ 'ngResource',
'xos.xos',
'xos.hpcapi',
'xos.xoslib',
@@ -23,7 +24,6 @@
.config(config);
function config($httpProvider, $interpolateProvider, $resourceProvider) {
- console.log('xos.helpers config')
$httpProvider.interceptors.push('SetCSRFToken');
$interpolateProvider.startSymbol('{$');