diff --git a/.codeclimate.yml b/.codeclimate.yml index a8964f5..c45ed4e 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -13,6 +13,8 @@ engines: - php eslint: enabled: true + exclude_fingerprints: + - 74cd3d3cf3dab02564766a2a0522b601 checks: no-undef: enabled: false diff --git a/app/components/activity-chart/component.spec.js b/app/components/activity-chart/component.spec.js new file mode 100644 index 0000000..246a8e7 --- /dev/null +++ b/app/components/activity-chart/component.spec.js @@ -0,0 +1,17 @@ +describe('activityChart', function() { + + // Load the module that contains the `activityChart` component before each test + beforeEach(module('gitdashApp')); + + // Test the controller + describe('ActivityChartController', function() { + + it('should check length of activities', inject(function($componentController) { + var $scope = {}; + var ctrl = $componentController('activityChart', {$scope: $scope}); + expect($scope.data.length).toBe(17); + })); + + }); + +}); \ No newline at end of file diff --git a/app/components/activity-graph/component.spec.js b/app/components/activity-graph/component.spec.js new file mode 100644 index 0000000..387565e --- /dev/null +++ b/app/components/activity-graph/component.spec.js @@ -0,0 +1,17 @@ +describe('activityGraph', function() { + + // Load the module that contains the `activityChart` component before each test + beforeEach(module('gitdashApp')); + + // Test the controller + describe('ActivityGraphController', function() { + + it('should check length of activities', inject(function($componentController) { + var $scope = {}; + var ctrl = $componentController('activityGraph', {$scope: $scope}); + expect($scope.data.length).toBe(3); + })); + + }); + +}); \ No newline at end of file diff --git a/app/components/language-chart/component.spec.js b/app/components/language-chart/component.spec.js new file mode 100644 index 0000000..22d7e2f --- /dev/null +++ b/app/components/language-chart/component.spec.js @@ -0,0 +1,17 @@ +describe('languageChart', function() { + + // Load the module that contains the `languageChart` component before each test + beforeEach(module('gitdashApp')); + + // Test the controller + describe('LanguageChartController', function() { + + it('should check length of languages', inject(function($componentController) { + var $scope = {}; + var ctrl = $componentController('languageChart', {$scope: $scope}); + expect($scope.data.length).toBe(12); + })); + + }); + +}); \ No newline at end of file diff --git a/app/components/profile-chart/component.spec.js b/app/components/profile-chart/component.spec.js new file mode 100644 index 0000000..7763159 --- /dev/null +++ b/app/components/profile-chart/component.spec.js @@ -0,0 +1,15 @@ +describe('profileChart', function() { + + // Load the module that contains the `profileChart` component before each test + beforeEach(module('gitdashApp')); + + // Test the controller + describe('ProfileChartController', function() { + + it('should check if profile loaded or not', inject(function($componentController) { + var $scope = {}; + var ctrl = $componentController('profileChart', {$scope: $scope}); + expect($scope.userData).toBeDefined(); + })); + }); +}); \ No newline at end of file diff --git a/app/components/pullrequest-list/component.spec.js b/app/components/pullrequest-list/component.spec.js new file mode 100644 index 0000000..aef2931 --- /dev/null +++ b/app/components/pullrequest-list/component.spec.js @@ -0,0 +1,19 @@ +describe('pullrequestList', function() { + + // Load the module that contains the `pullrequestList` component before each test + beforeEach(module('gitdashApp')); + + // Test the controller + describe('PullrequestListController', function() { + + it('should load pullrequestevents', inject(function($componentController) { + var $scope = {}; + var ctrl = $componentController('pullrequestList', {$scope: $scope}); + expect($scope.openPullRequests).toBeDefined(); + expect($scope.closedPullRequests).toBeDefined(); + + })); + + }); + +}); \ No newline at end of file diff --git a/app/components/pushevent-list/component.spec.js b/app/components/pushevent-list/component.spec.js new file mode 100644 index 0000000..d6af1ff --- /dev/null +++ b/app/components/pushevent-list/component.spec.js @@ -0,0 +1,17 @@ +describe('pusheventList', function() { + + // Load the module that contains the `pusheventList` component before each test + beforeEach(module('gitdashApp')); + + // Test the controller + describe('PusheventListController', function() { + + it('should load pushevent', inject(function($componentController) { + var $scope = {}; + var ctrl = $componentController('pusheventList', {$scope: $scope}); + expect($scope.pushEvents).toBeDefined(); + })); + + }); + +}); \ No newline at end of file diff --git a/app/components/repo-list/component.spec.js b/app/components/repo-list/component.spec.js new file mode 100644 index 0000000..e91ffc9 --- /dev/null +++ b/app/components/repo-list/component.spec.js @@ -0,0 +1,17 @@ +describe('repoList', function() { + + // Load the module that contains the `repoList` component before each test + beforeEach(module('gitdashApp')); + + // Test the controller + describe('RepoListController', function() { + + it('should load repos', inject(function($componentController) { + var $scope = {}; + var ctrl = $componentController('repoList', {$scope: $scope}); + expect($scope.reposLoaded).toBeDefined(); + })); + + }); + +}); \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..20060b0 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,77 @@ +// Karma configuration +// Generated on Sat Aug 27 2016 13:38:29 GMT+0530 (IST) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'node_modules/angular/angular.js', + 'node_modules/angular-route/angular-route.min.js', + 'node_modules/angular-mocks/angular-mocks.js', + 'node_modules/d3/d3.js', + 'node_modules/nvd3/build/nv.d3.js', + 'node_modules/angular-nvd3/dist/angular-nvd3.js', + 'app/app-config/app.js', + 'dist/js/script.js', + 'app/components/**/component.spec.js' + ], + + + // list of files to exclude + exclude: [ + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['Chrome'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/package.json b/package.json index b2c94cd..8510636 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,11 @@ "gulp-sass": "^2.3.2", "gulp-uglify": "^2.0.0", "gulp-util": "^3.0.7", + "jasmine-core": "^2.4.1", "jshint": "^2.9.3", + "karma": "^1.2.0", + "karma-chrome-launcher": "^2.0.0", + "karma-jasmine": "^1.0.2", "merge-stream": "^1.0.0", "node-sass": "^3.8.0", "nodemon": "^1.10.2"