Skip to content

Instantly share code, notes, and snippets.

Jim Newbery froots

Block or report user

Report or block froots

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@froots
froots / gist:3164377
Created Jul 23, 2012 — forked from danscotton/gist:3164353
mocking with amd
View gist:3164377
// ----------------------------------------
// /path/to/dependency.js
define(function() {
return {
doSomethingWithIt: function() {
// blah
}
};
});
@froots
froots / jasmine.md
Created Jan 3, 2012 — forked from addyosmani/jasmine.md
Rough-work for Jasmine section of Backbone Fundamentals
View jasmine.md

##Introduction

One definition of unit testing is the process of taking the smallest piece of testable code in an application, isolating it from the remainder of your codebase and determining if it behaves exactly as expected. In this section, we'll be taking a look at how to unit test Backbone applications using a popular JavaScript testing framework called Jasmine.

For an application to be considered 'well'-tested, distinct functionality should ideally have its own separate unit tests where it's tested against the different conditions you expect it to work under. All tests must pass before functionality is considered 'complete'. This allows developers to both modify a unit of code and it's dependencies with a level of confidence about whether these changes have caused any breakage.

As a basic example of unit testing is where a developer may wish to assert whether passing specific values through to a sum function results in the correct output being returned. For an example more relevant to this book,

You can’t perform that action at this time.