Skip to content

Commit

Permalink
init test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
chirimoya committed Sep 27, 2013
1 parent 3e76e7f commit cbea1ed
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"globals": {
"require": false,
"define": false,
"Globalize": false
"Globalize": false,
"describe": false,
"it": false,
"expect": false
},
"bitwise": true,
"camelcase": true,
Expand Down
16 changes: 10 additions & 6 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ basePath = '';
files = [
JASMINE,
JASMINE_ADAPTER,
REQUIRE,
REQUIRE_ADAPTER,

'bower_components/jquery/jquery.js',
'node_modules/sinon/pkg/sinon.js',
{ pattern: 'bower_components/**/*.js', included: false},
{ pattern: 'lib/*.js', included: false},
{ pattern: 'husky_extensions/*.js', included: false},
{ pattern: 'husky_components/**/*.js', included: false},

'js/*.js',
'js/**/*.js',
'tests/*.js',
'tests/**/*.js'
{ pattern: 'tests/*Spec.js', included: false},
{ pattern: 'tests/**/*Spec.js', included: false},

'tests/runner.js'
];


Expand Down
16 changes: 10 additions & 6 deletions karma.travis.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ basePath = '';
files = [
JASMINE,
JASMINE_ADAPTER,
REQUIRE,
REQUIRE_ADAPTER,

'bower_components/jquery/jquery.js',
'node_modules/sinon/pkg/sinon.js',
{ pattern: 'bower_components/**/*.js', included: false},
{ pattern: 'lib/*.js', included: false},
{ pattern: 'husky_extensions/*.js', included: false},
{ pattern: 'husky_components/**/*.js', included: false},

'js/*.js',
'js/**/*.js',
'tests/*.js',
'tests/**/*.js'
{ pattern: 'tests/*Spec.js', included: false},
{ pattern: 'tests/**/*Spec.js', included: false},

'tests/runner.js'
];


Expand Down
3 changes: 3 additions & 0 deletions lib/husky.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ define([
Husky.prototype = Object.create(Aura.prototype);
Husky.prototype.constructor = Husky;

// Husky version flag
Husky.prototype.version = '0.1.0';

return Husky;
});
15 changes: 15 additions & 0 deletions test-results.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<testsuites>
<testsuite name="Firefox 23.0 (Mac)" package="" timestamp="2013-09-27T06:49:40" id="0" hostname="Escudo.local" tests="2" errors="0" failures="0" time="0.008">
<properties>
<property name="browser.fullName" value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0"/>
</properties>
<testcase name="version check" time="0.003" classname="Firefox 23.0 (Mac).Husky"/>
<testcase name="application start" time="0.005" classname="Firefox 23.0 (Mac).Husky"/>
<system-out><![CDATA[Firefox 23.0 (Mac) LOG: [ 'aura_2:', 'Starting Aura' ]
,Firefox 23.0 (Mac) LOG: [ 'aura_2:', 'Starting Aura' ]
]]></system-out>
<system-err/>
</testsuite>
</testsuites>
27 changes: 27 additions & 0 deletions tests/HuskySpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
define(['husky', 'jquery'], function(husky, $) {

'use strict';

var app;

describe('Husky', function() {

it('version check', function() {
app = husky({ debug: { enable: true }});

expect(app.version).toBe('0.1.0');

app.stop();
});

it('start application', function() {

app = husky({ debug: { enable: true }});

app.start().then(function() {
app.logger.log('Aura started...');
});
});
});

});
6 changes: 6 additions & 0 deletions tests/components/NavigationSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
define(['husky'], function(husky) {

'use strict';


});
Empty file removed tests/husky.js
Empty file.
31 changes: 31 additions & 0 deletions tests/runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var tests = [];
for (var file in window.__karma__.files) {
if (window.__karma__.files.hasOwnProperty(file)) {
if (/-spec\.js$/.test(file)) {
tests.push(file);
}
}
}

require.config({
// Karma serves files from '/base'
baseUrl: '/base',

paths: {
'jquery': 'bower_components/jquery/jquery',
'sinon': 'node_modules/sinon/pkg/sinon.js',
'husky': 'lib/husky'
},

shim: {
'underscore': {
exports: '_'
}
},

// ask Require.js to load these files (all our tests)
deps: tests,

// start test run, once Require.js is done
callback: window.__karma__.start
});

0 comments on commit cbea1ed

Please sign in to comment.