forked from rmurphey/js-assessment
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flow control, module tests wip; more objects tests
- Loading branch information
Showing
4 changed files
with
70 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
define([ 'use!underscore' ], function(_) { | ||
describe("flow control", function() { | ||
var fn; | ||
|
||
beforeEach(function() { | ||
fn = function() { }; | ||
}); | ||
|
||
it("you should be able to conditionally branch your code", function() { | ||
fn = function() { | ||
// write a function that receives a number as its argument; | ||
// if the number is divisible by 3, the function should return 'fizz'; | ||
// if the number is divisible by 5, the function should return 'buzz'; | ||
// if the number is divisible the 3 and 5, the function should return | ||
// 'fizzbuzz'; | ||
// otherwise the function should return the number | ||
}; | ||
|
||
// replace the following test with tests that prove your function works | ||
expect(fn()).to.be.ok(); | ||
}); | ||
|
||
it("you should be able to work with logical operators", function() { | ||
var and = function(val1, val2) { | ||
// write a function that makes the tests below pass | ||
}, | ||
|
||
or = function(val1, val2) { | ||
// write a function that makes the tests below pass | ||
}; | ||
|
||
expect(and(false, false)).not.to.be.ok(); | ||
expect(and(true, false)).not.to.be.ok(); | ||
expect(and(true, true)).to.be.ok(); | ||
|
||
expect(or(true, false)).to.be.ok(); | ||
expect(or(true, true)).to.be.ok(); | ||
expect(or(false, false)).not.to.be.ok(); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
define([ 'use!underscore' ], function(_) { | ||
describe("the module pattern", function() { | ||
var fn = function() {}; | ||
|
||
it("you should be able to create a function that returns a module", function() { | ||
fn = function() { | ||
// write a function that makes the tests pass | ||
}; | ||
|
||
var module = fn('hello', 'matt'); | ||
expect(module.name).to.be.ok(); | ||
expect(module.greeting).to.be.ok(); | ||
expect(module.sayIt).to.be.a('function'); | ||
expect(module.sayIt()).to.be('hello, matt'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters