Skip to content

Commit

Permalink
Add initial unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike committed Dec 21, 2012
1 parent 13d1a1a commit d548e4c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 34 deletions.
17 changes: 14 additions & 3 deletions grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ module.exports = function(grunt) {
files: ['test/**/*.html']
},
lint: {
files: ['grunt.js', 'src/**/*.js', 'test/**/*.js']
source: ['src/**/*.js'],
build: ['grunt.js'],
tests: ['test/**/*.js']
},
watch: {
files: '<config:lint.files>',
Expand All @@ -47,8 +49,17 @@ module.exports = function(grunt) {
eqnull: true,
browser: true
},
globals: {
jQuery: true
tests: {
globals: {
module: true,
equal: true,
test: true
}
},
source: {
globals: {
jQuery: true
}
}
},
uglify: {}
Expand Down
41 changes: 10 additions & 31 deletions test/backbone.search_test.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,17 @@
/*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/
/*global start:false, stop:false ok:false, equal:false, notEqual:false, deepEqual:false*/
/*global notDeepEqual:false, strictEqual:false, notStrictEqual:false, raises:false*/
/*global Backbone:false, _: false, console: false*/
(function($, Backbone, _) {
(function(window, $, Backbone, _, undefined) {

/*
======== A Handy Little QUnit Reference ========
http://docs.jquery.com/QUnit
Test methods:
expect(numAssertions)
stop(increment)
start(decrement)
Test assertions:
ok(value, [message])
equal(actual, expected, [message])
notEqual(actual, expected, [message])
deepEqual(actual, expected, [message])
notDeepEqual(actual, expected, [message])
strictEqual(actual, expected, [message])
notStrictEqual(actual, expected, [message])
raises(block, [expected], [message])
*/

module('tbd', {
module("tbd", {
setup: function() {
//setupcode
this.coll = new Backbone.Collection([
{ id: 0, title: "Welcome Isaac Durazo" },
{ id: 1, title: "Ringmark Tests Open Source" },
{ id: 2, title: "Bocoup Gamelab" }
]);
}
});

test('myfirsttest', 1, function() {
// Not a bad test to run on collection methods.
equal(1, 1, '1 equals 1');
test("Defines a 'search' method on Backbone collections", 1, function() {
equal(typeof this.coll.search, "function");
});


}(jQuery, Backbone, _));
}(this, this.jQuery, this.Backbone, this._));

0 comments on commit d548e4c

Please sign in to comment.