added karma test framework and network skeleton
This commit is contained in:
parent
37f8ab3ab4
commit
6f1b60e562
8 changed files with 144 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -44,3 +44,5 @@ public/js/vendors.js
|
||||||
public/css/main.css
|
public/css/main.css
|
||||||
|
|
||||||
README.html
|
README.html
|
||||||
|
|
||||||
|
lib
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"angular": "~1.2.x",
|
"angular": "~1.2.x",
|
||||||
"angular-bootstrap": "~0.10.0",
|
"angular-bootstrap": "~0.10.0",
|
||||||
"angular-route": "~1.2.14"
|
"angular-route": "~1.2.14",
|
||||||
|
"peerjs": "~0.3.8",
|
||||||
|
"angular-mocks": "~1.2.14"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"mocha": "~1.18.2",
|
||||||
|
"chai": "~1.9.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
<script src="lib/angular-bootstrap/ui-bootstrap.min.js"></script>
|
<script src="lib/angular-bootstrap/ui-bootstrap.min.js"></script>
|
||||||
<script src="lib/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
|
<script src="lib/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
|
||||||
|
<script src="lib/peerjs/peer.js"></script>
|
||||||
|
|
||||||
<script src="js/app.js"></script>
|
<script src="js/app.js"></script>
|
||||||
<script src="js/config.js"></script>
|
<script src="js/config.js"></script>
|
||||||
|
|
|
||||||
7
js/network.js
Normal file
7
js/network.js
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
var cosign = angular.module('cosign', []);
|
||||||
|
cosign.service('network', function() {
|
||||||
|
this.f = function() {
|
||||||
|
return 2;
|
||||||
|
};
|
||||||
|
});
|
||||||
72
karma.conf.js
Normal file
72
karma.conf.js
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
// Karma configuration
|
||||||
|
// Generated on Fri Mar 21 2014 17:52:41 GMT-0300 (ART)
|
||||||
|
|
||||||
|
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: ['mocha'],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files / patterns to load in the browser
|
||||||
|
files: [
|
||||||
|
'lib/angular/angular.min.js',
|
||||||
|
'lib/angular-mocks/angular-mocks.js',
|
||||||
|
'lib/chai/chai.js',
|
||||||
|
'js/*.js',
|
||||||
|
'js/**/*.js',
|
||||||
|
'test/test*.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: [],
|
||||||
|
|
||||||
|
|
||||||
|
// Continuous Integration mode
|
||||||
|
// if true, Karma captures browsers, runs the tests and exits
|
||||||
|
singleRun: false
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
@ -19,6 +19,10 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/bitpay/cosign",
|
"homepage": "https://github.com/bitpay/cosign",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt-cli": "~0.1.13"
|
"grunt-cli": "~0.1.13",
|
||||||
|
"karma": "~0.12.1",
|
||||||
|
"karma-chrome-launcher": "~0.1.2",
|
||||||
|
"mocha": "~1.18.2",
|
||||||
|
"karma-mocha": "~0.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
29
test/test.html
Normal file
29
test/test.html
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Cosign tests</title>
|
||||||
|
<link rel="stylesheet" media="all" href="../lib/mocha/mocha.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<div id="messages"></div>
|
||||||
|
<div id="fixtures"></div>
|
||||||
|
<script src="../lib/mocha/mocha.js"></script>
|
||||||
|
<script src="../lib/chai/chai.js"></script>
|
||||||
|
<script src="../lib/angular/angular.min.js"></script>
|
||||||
|
|
||||||
|
<script src="../js/app.js"></script>
|
||||||
|
<script src="../js/config.js"></script>
|
||||||
|
<script src="../js/directives.js"></script>
|
||||||
|
<script src="../js/filters.js"></script>
|
||||||
|
<script src="../js/init.js"></script>
|
||||||
|
<script src="../js/network.js"></script>
|
||||||
|
|
||||||
|
<script>mocha.setup('bdd')</script>
|
||||||
|
|
||||||
|
<script src="test.network.js"></script>
|
||||||
|
|
||||||
|
<script>mocha.run();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
21
test/test.network.js
Normal file
21
test/test.network.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var should = chai.should();
|
||||||
|
describe('Network service', function() {
|
||||||
|
|
||||||
|
var network;
|
||||||
|
beforeEach(angular.mock.module('cosign'));
|
||||||
|
|
||||||
|
it('should exist', function() {
|
||||||
|
inject(function($injector) {
|
||||||
|
network = $injector.get('network');
|
||||||
|
should.exist(network);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should return 2', function() {
|
||||||
|
network.f().should.equal(2);
|
||||||
|
});
|
||||||
|
it('should', function() {});
|
||||||
|
it('should', function() {});
|
||||||
|
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue