ywca-chapter03
Advanced tools
Comparing version 0.1.4 to 0.1.5
{ | ||
"name": "ywca-chapter03", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Yeoman generator", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -478,7 +478,4 @@ /************************* Defining a Function **************************/ | ||
describe( "Closures 1", function() { | ||
beforeAll(function () { | ||
Exer.spaceCubeDetector = Exer.closures1(); | ||
}); | ||
it("should return a partially curried function that returns \"THIS IS NO SPACE CUBE!\" when given 4 and 2 and then 5", function() { | ||
var result = Exer.spaceCubeDetector(4, 2); | ||
var result = Exer.closures1()(4, 2); | ||
expect( typeof result ).toBe("function"); | ||
@@ -489,3 +486,3 @@ result = result(5); | ||
it("should return a partially curried function that returns \"SPACE CUBE DETECTED\" when given 5 and 5 and then 5", function() { | ||
var result = Exer.spaceCubeDetector(5, 5); | ||
var result = Exer.closures1()(5, 5); | ||
expect( typeof result ).toBe("function"); | ||
@@ -497,7 +494,4 @@ var result = result(5); | ||
describe( "Closures 2", function() { | ||
beforeAll(function () { | ||
Exer.spaceCubeDetector = Exer.closures2(); | ||
}); | ||
it("should return a curried function that returns \"THIS IS NO SPACE CUBE!\" when given 4, 2, and then 5", function() { | ||
var result = Exer.spaceCubeDetector(4); | ||
var result = Exer.closures2()(4); | ||
expect( typeof result ).toBe("function"); | ||
@@ -510,3 +504,3 @@ result = result(2); | ||
it("should return a curried function that returns \"SPACE CUBE DETECTED!!\" when given 5, 5, and then 5", function() { | ||
var result = Exer.spaceCubeDetector(5); | ||
var result = Exer.closures2()(5); | ||
expect( typeof result ).toBe("function"); | ||
@@ -589,2 +583,3 @@ result = result(5); | ||
it("should not call the functions that are not pure", function() { | ||
Exer.sideEffect1(); | ||
expect( global.bark ).not.toHaveBeenCalled(); | ||
@@ -598,11 +593,11 @@ expect( global.getBarkNoise ).not.toHaveBeenCalled(); | ||
Exer.sideEffect2(); | ||
expect( bark.calls.count() ).toBeGreaterThan(0); | ||
expect( getBarkNoise.calls.count() ).toBeGreaterThan(0); | ||
expect( setBarkNoise.calls.count() ).toBeGreaterThan(0); | ||
expect( bark.calls.count() ).toHaveBeenCalled(); | ||
expect( getBarkNoise.calls.count() ).toHaveBeenCalled(); | ||
expect( setBarkNoise.calls.count() ).toHaveBeenCalled(); | ||
}); | ||
it("should not call the functions that are pure", function() { | ||
expect( pairsOfLegsToTotalLegs.calls.count() ).not.toBeGreaterThan(0); | ||
expect( hasTail.calls.count() ).not.toBeGreaterThan(0); | ||
}); | ||
Exer.sideEffect2(); | ||
expect( pairsOfLegsToTotalLegs.calls.count() ).not.toHaveBeenCalled(); | ||
expect( hasTail.calls.count() ).not.toHaveBeenCalled(); | ||
}); | ||
}); |
82217
1420