update to angular 1.7
This commit is contained in:
Родитель
e040e769d2
Коммит
5dadbfc7ba
|
@ -75,12 +75,12 @@ module.exports = function (grunt) {
|
|||
files: ['src/**/*.js', '!src/client/app.min.js']
|
||||
},
|
||||
mocha: {
|
||||
tasks: ['mocha_istanbul'],
|
||||
tasks: ['mochaTest:server'],
|
||||
files: ['src/**/*.js', '!src/client/app.min.js']
|
||||
},
|
||||
karma: {
|
||||
tasks: ['karma'],
|
||||
files: ['src/**/*.js', '!src/client/app.min.js']
|
||||
files: ['src/client/**/*.js', '!src/client/app.min.js']
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -5,11 +5,7 @@
|
|||
"bootstrap-sass-official": "~3.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"angular-mocks": "~1.3.14",
|
||||
"angular-mocks": "1.7.0",
|
||||
"should": "~3.3.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"angular": "1.6.9-build.5546+sha.ab386cd",
|
||||
"angular-mocks": "~1.3.14"
|
||||
}
|
||||
}
|
|
@ -110,6 +110,11 @@
|
|||
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
|
||||
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU="
|
||||
},
|
||||
"angular": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/angular/-/angular-1.7.0.tgz",
|
||||
"integrity": "sha512-3LboCLjrOuC7dWh953O0+dI3dJ7PexYRSCIrfqoN5qoHyja/wak3eWoxPKb2Sl2qwiPbrUV5KJXwgpUQ48McBQ=="
|
||||
},
|
||||
"ansi-escapes": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
|
||||
|
@ -501,7 +506,6 @@
|
|||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
|
||||
"integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"tweetnacl": "0.14.5"
|
||||
}
|
||||
|
@ -1587,7 +1591,6 @@
|
|||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
|
||||
"integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"jsbn": "0.1.1"
|
||||
}
|
||||
|
@ -4807,8 +4810,7 @@
|
|||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
|
||||
"optional": true
|
||||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
|
||||
},
|
||||
"jsesc": {
|
||||
"version": "1.3.0",
|
||||
|
@ -8272,8 +8274,7 @@
|
|||
"tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
|
||||
"optional": true
|
||||
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
|
||||
},
|
||||
"type-check": {
|
||||
"version": "0.3.2",
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
"bugs": "https://github.com/cla-assistant/cla-assistant/issues",
|
||||
"contributors": [],
|
||||
"dependencies": {
|
||||
"angular": "^1.7.0",
|
||||
"array-sugar": "^1.2.2",
|
||||
"async": "^2.6.0",
|
||||
"body-parser": "^1.18.2",
|
||||
|
|
|
@ -29,8 +29,8 @@ module.factory('$RAW', ['$q', '$http',
|
|||
call: function (m, functn, data, callback) {
|
||||
var now = new Date();
|
||||
|
||||
return $http.post('/api/' + m + '/' + functn, data)
|
||||
.success(function (res) {
|
||||
return $http.post('/api/' + m + '/' + functn, data).then(
|
||||
function successCallback(res) {
|
||||
// parse result (again)
|
||||
try {
|
||||
res = JSON.parse(res);
|
||||
|
@ -38,30 +38,21 @@ module.factory('$RAW', ['$q', '$http',
|
|||
// doNothing
|
||||
}
|
||||
// yield result
|
||||
callback(null, res, new Date() - now);
|
||||
})
|
||||
.error(function (res) {
|
||||
callback(res, null, new Date() - now);
|
||||
});
|
||||
callback(null, res.data, new Date() - now);
|
||||
},
|
||||
function errorCallback(res) {
|
||||
callback(res.data, null, new Date() - now);
|
||||
}
|
||||
);
|
||||
},
|
||||
get: function (url, user_token) {
|
||||
var deferred = $q.defer();
|
||||
var header = {};
|
||||
header.Accept = 'application/vnd.github.moondragon+json';
|
||||
if (user_token) {
|
||||
header.Authorization = 'token ' + user_token;
|
||||
}
|
||||
$http.get(url, { 'headers': header }).
|
||||
success(function (data) {
|
||||
deferred.resolve(data);
|
||||
// callback(null, data, status);
|
||||
})
|
||||
.error(function (err) {
|
||||
deferred.reject(err);
|
||||
// callback(err, null, status);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
return $http.get(url, { 'headers': header });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -194,7 +185,7 @@ module.factory('$HUBService', ['$q', '$HUB',
|
|||
deferred.resolve(obj);
|
||||
}
|
||||
|
||||
return deferred.reject(err);
|
||||
return deferred.reject(new Error(err));
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
var module = angular.module('app', ['cla.filters',
|
||||
'cla.config',
|
||||
'ui.utils',
|
||||
'ui.router',
|
||||
'ui.bootstrap',
|
||||
|
@ -7,35 +6,11 @@ var module = angular.module('app', ['cla.filters',
|
|||
'ui.select',
|
||||
'ngSanitize',
|
||||
'ngAnimate',
|
||||
'ngCsv',
|
||||
'angulartics',
|
||||
'angulartics.google.analytics'
|
||||
'ngCsv'
|
||||
]);
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var filters = angular.module('cla.filters', []);
|
||||
|
||||
angular.module('cla.config', [])
|
||||
.provider('$config', function () {
|
||||
|
||||
function Config($http) {
|
||||
this.get = function (done) {
|
||||
$http.get('/config')
|
||||
.success(function (data, status) {
|
||||
done(data || {}, status);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
this.$get = ['$http',
|
||||
function ($http) {
|
||||
return new Config($http);
|
||||
}
|
||||
];
|
||||
|
||||
// var url = $.url();
|
||||
//
|
||||
// this.log = url.param('log') === 'true' || document.location.hostname === 'localhost';
|
||||
});
|
||||
// *************************************************************
|
||||
// Delay start
|
||||
// *************************************************************
|
||||
|
@ -126,17 +101,4 @@ module.config(['$stateProvider', '$urlRouterProvider', '$locationProvider',
|
|||
requireBase: false
|
||||
});
|
||||
}
|
||||
])
|
||||
.run(['$rootScope', '$state', '$stateParams', '$config',
|
||||
function ($rootScope, $state, $stateParams, $config) {
|
||||
$rootScope.$state = $state;
|
||||
$rootScope.$stateParams = $stateParams;
|
||||
|
||||
$config.get(function (data) {
|
||||
$rootScope.$config = data;
|
||||
if (data.gacode) {
|
||||
ga('create', data.gacode, 'auto');
|
||||
}
|
||||
});
|
||||
}
|
||||
]);
|
||||
]);
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
// tmpl: cla.html
|
||||
// *****************************************************
|
||||
|
||||
module.controller('ClaController', ['$log', '$window', '$scope', '$stateParams', '$RAW', '$RPCService', '$HUBService', '$sce', '$timeout', '$http', '$q', 'utils',
|
||||
function ($log, $window, $scope, $stateParams, $RAW, $RPCService, $HUBService, $sce, $timeout, $http, $q, utils) {
|
||||
module.controller('ClaController', ['$log', '$window', '$scope', '$stateParams', '$RPCService', '$HUBService', '$sce', '$timeout', '$http', '$q', 'utils',
|
||||
function ($log, $window, $scope, $stateParams, $RPCService, $HUBService, $sce, $timeout, $http, $q, utils) {
|
||||
|
||||
$scope.cla = null;
|
||||
$scope.customFields = {};
|
||||
|
@ -163,6 +163,7 @@ module.controller('ClaController', ['$log', '$window', '$scope', '$stateParams',
|
|||
$window.location.href = $stateParams.pullRequest ? acceptUrl + '?pullRequest=' + $stateParams.pullRequest : acceptUrl;
|
||||
};
|
||||
|
||||
|
||||
var userPromise = getUser();
|
||||
var claPromise;
|
||||
var repoPromise = getLinkedItem(function (linkedItem) {
|
||||
|
@ -215,6 +216,8 @@ module.controller('ClaController', ['$log', '$window', '$scope', '$stateParams',
|
|||
}
|
||||
});
|
||||
}
|
||||
}, function errorCallback() {
|
||||
// empty
|
||||
});
|
||||
}
|
||||
])
|
||||
|
|
|
@ -285,22 +285,22 @@ module.controller('HomeCtrl', ['$rootScope', '$scope', '$document', '$HUB', '$RP
|
|||
|
||||
$scope.getDefaultClaFiles = function () {
|
||||
var promise = $RAW.get('/static/cla-assistant.json');
|
||||
promise.then(function (data) {
|
||||
$scope.defaultClas = data['default-cla'];
|
||||
promise.then(function (res) {
|
||||
$scope.defaultClas = res.data['default-cla'];
|
||||
});
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
$scope.count = function () {
|
||||
$RAW.get('/count/clas').then(function (data) {
|
||||
$scope.numberClas = data.count;
|
||||
$RAW.get('/count/clas').then(function (res) {
|
||||
$scope.numberClas = res.data.count;
|
||||
});
|
||||
$RAW.get('/count/repos').then(function (data) {
|
||||
$scope.numberRepos = data.count;
|
||||
$RAW.get('/count/repos').then(function (res) {
|
||||
$scope.numberRepos = res.data.count;
|
||||
});
|
||||
$RAW.get('/count/stars').then(function (data) {
|
||||
$scope.numberStars = data.count;
|
||||
$RAW.get('/count/stars').then(function (res) {
|
||||
$scope.numberStars = res.data.count;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ module.controller('MyClaCtrl', ['$scope', '$filter', '$HUB', '$RAW', '$RPCServic
|
|||
};
|
||||
|
||||
$scope.getDefaultClaFiles = function () {
|
||||
return $RAW.get('/static/cla-assistant.json').then(function (data) {
|
||||
$scope.defaultClas = data['default-cla'];
|
||||
return $RAW.get('/static/cla-assistant.json').then(function (res) {
|
||||
$scope.defaultClas = res.data['default-cla'];
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -8,29 +8,18 @@
|
|||
<base href="/">
|
||||
<!-- COMPONENT SCRIPTS -->
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-animate.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-route.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.13/angular-ui-router.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.0/angular.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.0/angular-animate.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.0/angular-route.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/1.0.17/angular-ui-router.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.4/ui-bootstrap-tpls.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-select/0.11.2/select.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-select/0.19.8/select.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-utils/0.1.1/angular-ui-utils.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-sanitize.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.0/angular-sanitize.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-scroll/0.6.5/angular-scroll.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/ng-csv/0.3.3/ng-csv.min.js"></script>
|
||||
<script src="//www.google-analytics.com/analytics.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angulartics/0.17.2/angulartics.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angulartics/0.17.2/angulartics-ga.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/PapaParse/4.1.2/papaparse.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.5/clipboard.min.js"></script>
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date(); a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||
</script>
|
||||
<!-- APP -->
|
||||
<script src="app.min.js"></script>
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
// modules
|
||||
let express = require('express');
|
||||
|
||||
let router = express.Router();
|
||||
|
||||
router.all('/config', function (req, res) {
|
||||
res.set('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify({
|
||||
gacode: config.client.gacode
|
||||
}));
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -5,6 +5,7 @@ angular.module('app');
|
|||
describe('CLA Controller', function () {
|
||||
var scope, _timeout, stateParams, httpBackend, createCtrl, claController, _window, _q, user, claSigned, claText, claTextWithMeta, _HUBService, _RPCService;
|
||||
var linkedItem;
|
||||
beforeEach(angular.mock.module('ngAnimateMock'));
|
||||
beforeEach(angular.mock.module('app'));
|
||||
beforeEach(angular.mock.module('templates'));
|
||||
beforeEach(angular.mock.module(function ($provide) {
|
||||
|
@ -64,7 +65,6 @@ describe('CLA Controller', function () {
|
|||
});
|
||||
|
||||
httpBackend = $injector.get('$httpBackend');
|
||||
httpBackend.when('GET', '/config').respond({});
|
||||
|
||||
scope = $rootScope.$new();
|
||||
stateParams = { user: 'login', repo: 'myRepo', pullRequest: '1' };
|
||||
|
@ -293,22 +293,24 @@ describe('CLA Controller', function () {
|
|||
_HUBService.call.restore();
|
||||
sinon.stub(_HUBService, 'call', function (o, functn, data, cb) {
|
||||
var deferred = _q.defer();
|
||||
cb('Authentication required', null);
|
||||
deferred.reject('Authentication required');
|
||||
cb({ data: 'Authentication required' }, null);
|
||||
deferred.reject(new Error('Authentication required'));
|
||||
|
||||
return deferred.promise;
|
||||
});
|
||||
try {
|
||||
claController = createCtrl();
|
||||
|
||||
claController = createCtrl();
|
||||
httpBackend.when('POST', '/api/cla/check', { repo: stateParams.repo, owner: stateParams.user }).respond(function () {
|
||||
claCheckWasCalled = true;
|
||||
|
||||
// httpBackend.expect('POST', '/api/github/call', { obj: 'user', fun: 'get', arg: {} }).respond(500, 'Authentication required');
|
||||
httpBackend.when('POST', '/api/cla/check', { repo: stateParams.repo, owner: stateParams.user }).respond(function () {
|
||||
claCheckWasCalled = true;
|
||||
return false;
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
httpBackend.flush();
|
||||
httpBackend.flush();
|
||||
} catch (error) {
|
||||
//empty
|
||||
}
|
||||
|
||||
(claCheckWasCalled).should.not.be.ok;
|
||||
});
|
||||
|
|
|
@ -127,6 +127,7 @@ describe('Home Controller', function () {
|
|||
var rpcRepoGetAllError;
|
||||
var rpcRepoCreate;
|
||||
|
||||
beforeEach(angular.mock.module('ngAnimateMock'));
|
||||
beforeEach(angular.mock.module('app'));
|
||||
beforeEach(angular.mock.module('templates'));
|
||||
|
||||
|
@ -285,10 +286,12 @@ describe('Home Controller', function () {
|
|||
return {
|
||||
then: function (cb) {
|
||||
cb({
|
||||
'default-cla': [{
|
||||
'name': 'first default cla',
|
||||
'url': 'https://gist.github.com/gistId'
|
||||
}]
|
||||
data: {
|
||||
'default-cla': [{
|
||||
name: 'first default cla',
|
||||
url: 'https://gist.github.com/gistId'
|
||||
}]
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -307,9 +310,6 @@ describe('Home Controller', function () {
|
|||
};
|
||||
|
||||
// homeCtrl = createCtrl();
|
||||
|
||||
httpBackend.when('GET', '/config').respond({});
|
||||
|
||||
// httpBackend.when('POST', '/api/github/direct_call', {
|
||||
// url: 'https://api.github.com/gists?per_page=100'
|
||||
// }).respond(testDataGists.data.concat(
|
||||
|
@ -321,12 +321,14 @@ describe('Home Controller', function () {
|
|||
// }
|
||||
// }
|
||||
// }]));
|
||||
httpBackend.when('GET', '/static/cla-assistant.json').respond({
|
||||
'default-cla': [{
|
||||
'name': 'first default cla',
|
||||
'url': 'https://gist.github.com/gistId'
|
||||
}]
|
||||
});
|
||||
// httpBackend.when('GET', '/static/cla-assistant.json').respond({
|
||||
// data: {
|
||||
// 'default-cla': [{
|
||||
// name: 'first default cla',
|
||||
// url: 'https://gist.github.com/gistId'
|
||||
// }]
|
||||
// }
|
||||
// });
|
||||
|
||||
}));
|
||||
|
||||
|
@ -346,7 +348,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should get user repos and mix claRepos data with repos data if user has admin rights', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.repos.length).should.be.equal(2);
|
||||
(homeCtrl.scope.claRepos.length).should.be.equal(1);
|
||||
|
@ -366,7 +368,6 @@ describe('Home Controller', function () {
|
|||
};
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.claOrgs.length).should.be.equal(1);
|
||||
|
@ -384,7 +385,6 @@ describe('Home Controller', function () {
|
|||
};
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
($RPCService.call.calledWithMatch('org', 'getForUser')).should.be.equal(true);
|
||||
|
@ -405,7 +405,7 @@ describe('Home Controller', function () {
|
|||
};
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
($RPCService.call.calledWithMatch('org', 'getForUser')).should.be.equal(false);
|
||||
($RPCService.call.calledWithMatch('org', 'getGHOrgsForUser')).should.be.equal(true);
|
||||
|
@ -422,7 +422,7 @@ describe('Home Controller', function () {
|
|||
};
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.reposAndOrgs.length).should.be.equal(2);
|
||||
});
|
||||
|
@ -431,7 +431,7 @@ describe('Home Controller', function () {
|
|||
expRes.HUB.getUser.meta.scopes += ', admin:org_hook';
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.user.value.org_admin).should.be.equal(true);
|
||||
(homeCtrl.scope.reposAndOrgs.length).should.be.equal(4);
|
||||
|
@ -439,7 +439,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should not get user orgs if the user has no admin:org_hook right', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.user.value.org_admin).should.be.equal(false);
|
||||
(homeCtrl.scope.orgs).should.not.be.equal(testDataOrgs);
|
||||
|
@ -450,7 +450,7 @@ describe('Home Controller', function () {
|
|||
expRes.HUB.getUser.meta.scopes += ', admin:org_hook';
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.orgs.length).should.be.equal(testDataOrgs.length);
|
||||
(homeCtrl.scope.repos.length).should.be.equal(2);
|
||||
|
@ -459,7 +459,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should group orgs and repos', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.groupOrgs(testDataOrgs[0])).should.be.equal('Organisations');
|
||||
(homeCtrl.scope.groupOrgs(testDataRepos[0])).should.not.be.equal('Organisations');
|
||||
|
@ -513,7 +513,7 @@ describe('Home Controller', function () {
|
|||
getAllReposError = 'Github call failed';
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.repos.length).should.be.equal(0);
|
||||
($RPCService.call.calledWithMatch('repo', 'getAll')).should.be.equal(false);
|
||||
|
@ -523,7 +523,7 @@ describe('Home Controller', function () {
|
|||
rpcRepoGetAllError = 'Could not find entries on DB';
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.claRepos.length).should.be.equal(0);
|
||||
});
|
||||
|
@ -533,7 +533,7 @@ describe('Home Controller', function () {
|
|||
httpBackend.resetExpectations();
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.repos.length).should.be.equal(0);
|
||||
(homeCtrl.scope.user.value.admin).should.be.equal(false);
|
||||
|
@ -545,14 +545,14 @@ describe('Home Controller', function () {
|
|||
};
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.repos.length).should.be.equal(0);
|
||||
});
|
||||
|
||||
it('should create repo entry on link action', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
homeCtrl.scope.repos = [{
|
||||
name: 'myRepo',
|
||||
|
@ -583,7 +583,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should link organisation', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
homeCtrl.scope.orgs = testDataOrgs;
|
||||
homeCtrl.scope.selected.item = testDataOrgs[0];
|
||||
|
@ -601,7 +601,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should remove repo from claRepos list from github if create failed on backend', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
homeCtrl.scope.repos = [{
|
||||
name: 'myRepo',
|
||||
|
@ -634,7 +634,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should cleanup if create failed', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
homeCtrl.scope.selected.gist = {
|
||||
url: 'https://gist.github.com/gistId'
|
||||
|
@ -661,7 +661,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should delete db entry on remove for linked org', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
var org = {
|
||||
org: 'octocat',
|
||||
|
@ -677,7 +677,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should delete db entry on remove for linked repo', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
var repo = {
|
||||
repo: 'myRepo',
|
||||
|
@ -696,7 +696,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should load gist files of the user', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
(homeCtrl.scope.gists.length).should.be.equal(3);
|
||||
(homeCtrl.scope.gists[0].name).should.be.equal('first default cla');
|
||||
|
@ -706,7 +706,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should validate gist url', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
var invalidUrls = ['https://google.com', '', undefined];
|
||||
|
||||
|
@ -717,7 +717,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should identify default gist url from all gists', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
var sapClaGist = {
|
||||
name: 'first default cla',
|
||||
|
@ -734,7 +734,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should load default cla files', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
homeCtrl.scope.defaultClas.length.should.be.equal(1);
|
||||
homeCtrl.scope.defaultClas[0].name.should.be.equal('first default cla');
|
||||
|
@ -742,7 +742,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should clear selected repo on clear function', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
var ev = {
|
||||
stopPropagation: function () { }
|
||||
};
|
||||
|
@ -756,7 +756,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should clear selected cla on clear function', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
var ev = {
|
||||
stopPropagation: function () { }
|
||||
};
|
||||
|
@ -770,7 +770,7 @@ describe('Home Controller', function () {
|
|||
|
||||
it('should NOT load counts if user is logged', function () {
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
($RAW.get.calledWith('/count/clas')).should.be.equal(false);
|
||||
});
|
||||
|
||||
|
@ -779,7 +779,7 @@ describe('Home Controller', function () {
|
|||
expErr.HUB.getUser = 'Authentication required';
|
||||
|
||||
homeCtrl = createCtrl();
|
||||
httpBackend.flush();
|
||||
_timeout.flush();
|
||||
|
||||
($RAW.get.calledWith('/count/clas')).should.be.equal(true);
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
describe('Settings Controller', function () {
|
||||
|
||||
var scope, httpBackend, createCtrl, settingsCtrl, stateParams, modal, RPC, HUB, calledApi, $timeout;
|
||||
var scope, createCtrl, settingsCtrl, stateParams, modal, RPC, HUB, calledApi, $timeout;
|
||||
var testResp = { cla: {}, repo: {}, webhook: {} };
|
||||
var testErr = { cla: {}, repo: {}, webhook: {} };
|
||||
|
||||
|
@ -50,6 +50,8 @@ describe('Settings Controller', function () {
|
|||
}]
|
||||
};
|
||||
|
||||
beforeEach(angular.mock.module('ngAnimateMock'));
|
||||
|
||||
beforeEach(angular.mock.module('app'));
|
||||
beforeEach(angular.mock.module('templates'));
|
||||
|
||||
|
@ -59,8 +61,6 @@ describe('Settings Controller', function () {
|
|||
HUB = $HUB;
|
||||
$timeout = _$timeout_;
|
||||
|
||||
httpBackend = $injector.get('$httpBackend');
|
||||
|
||||
scope = $rootScope.$new();
|
||||
modal = $modal;
|
||||
scope.user = {
|
||||
|
@ -164,8 +164,6 @@ describe('Settings Controller', function () {
|
|||
login: 'octocat',
|
||||
admin: false
|
||||
};
|
||||
httpBackend.when('GET', '/config').respond({});
|
||||
|
||||
}));
|
||||
|
||||
afterEach(function () {
|
||||
|
|
|
@ -4,6 +4,8 @@ var utils, testData;
|
|||
|
||||
describe('Utils service', function () {
|
||||
beforeEach(angular.mock.module('app'));
|
||||
beforeEach(angular.mock.module('ngAnimateMock'));
|
||||
|
||||
|
||||
beforeEach(angular.mock.inject(function ($injector, _utils_) {
|
||||
utils = _utils_;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Karma configuration
|
||||
|
||||
module.exports = function(config) {
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
|
||||
basePath: '../../',
|
||||
|
@ -12,15 +12,15 @@ module.exports = function(config) {
|
|||
// Testing libs
|
||||
// CDN
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.13/angular-ui-router.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.0/angular.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/1.0.17/angular-ui-router.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular-ui-select/0.11.2/select.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular-ui-utils/0.1.1/angular-ui-utils.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular-scroll/0.6.5/angular-scroll.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-animate.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-route.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-sanitize.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.0/angular-animate.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.0/angular-route.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.0/angular-sanitize.min.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/ng-csv/0.3.3/ng-csv.min.js',
|
||||
'http://www.google-analytics.com/analytics.js',
|
||||
'http://cdnjs.cloudflare.com/ajax/libs/angulartics/0.17.2/angulartics.min.js',
|
||||
|
|
Загрузка…
Ссылка в новой задаче