Skip to content

Instantly share code, notes, and snippets.

@chrisfosterelli
Last active March 22, 2017 17:45
Show Gist options
  • Save chrisfosterelli/7c52597ebd9d2d55369b to your computer and use it in GitHub Desktop.
Save chrisfosterelli/7c52597ebd9d2d55369b to your computer and use it in GitHub Desktop.
WORKSHOP 2
==========
Welcome back!
At the end of each test, call me over and I'll give you some quick feedback!
Step 1: Open the Jasmine documentation, you'll need it!
: http://jasmine.github.io/2.3/introduction.html
Step 2: Create a test suite and Javascript file to make an HTTP
: request to the following url -> https://cors-test.appspot.com/test
: Your tests must be asynchronous! You can use jQuery requests.
Step 3: Create a test suite that tests the following code below.
: Both functions are part of one file (therefore one module).
: Your test must use two nested describes to test each function individually.
: You must test that the first function calls the second (use a stub!)
var myObject = {
change: function(num) {
return num * 10 * -1;
}
};
function myFunc(num) {
return num * myObject.change(num);
}
Step 4: Add a test to your last suite that tests the functions behaviour
: when passed unexpected values (strings, null, undefined).
: These tests should fail, so fix the code so that they don't!
Step 5: Create a function that returns after 3600 seconds.
: Write a test for this! There is a way to do this so that
: you don't need to wait an hour (clock manipulation), so you should
: use that.
...and you're done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment