Skip to content

Commit 6e9e0d1

Browse files
committed
Merge pull request mrdavidlaing#22 from pferdefleisch/remove-tabs-and-whitespace-from-specs
Replaces tabs with 2 spaces and removes whitespace from specs
2 parents dd71c36 + 20fc218 commit 6e9e0d1

8 files changed

+100
-100
lines changed

koans/AboutApplyingWhatWeHaveLearnt.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ describe("About Applying What We Have Learnt", function() {
44

55
var products;
66

7-
beforeEach(function () {
7+
beforeEach(function () {
88
products = [
99
{ name: "Sonoma", ingredients: ["artichoke", "sundried tomatoes", "mushrooms"], containsNuts: false },
1010
{ name: "Pizza Primavera", ingredients: ["roma", "sundried tomatoes", "goats cheese", "rosemary"], containsNuts: false },
@@ -47,14 +47,14 @@ describe("About Applying What We Have Learnt", function() {
4747
/*********************************************************************************/
4848

4949
it("should add all the natural numbers below 1000 that are multiples of 3 or 5 (imperative)", function () {
50-
50+
5151
var sum = 0;
5252
for(var i=1; i<1000; i+=1) {
5353
if (i % 3 === 0 || i % 5 === 0) {
5454
sum += i;
5555
}
5656
}
57-
57+
5858
expect(sum).toBe(FILL_ME_IN);
5959
});
6060

@@ -90,20 +90,20 @@ describe("About Applying What We Have Learnt", function() {
9090
/* UNCOMMENT FOR EXTRA CREDIT */
9191
/*
9292
it("should find the largest prime factor of a composite number", function () {
93-
93+
9494
});
9595
9696
it("should find the largest palindrome made from the product of two 3 digit numbers", function () {
97-
97+
9898
});
9999
100100
it("should find the smallest number divisible by each of the numbers 1 to 20", function () {
101-
102-
101+
102+
103103
});
104104
105105
it("should find the difference between the sum of the squares and the square of the sums", function () {
106-
106+
107107
});
108108
109109
it("should find the 10001st prime", function () {

koans/AboutArrays.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe("About Arrays", function() {
22

3-
//We shall contemplate truth by testing reality, via spec expectations.
3+
//We shall contemplate truth by testing reality, via spec expectations.
44
it("should create arrays", function() {
55
var emptyArray = [];
66
expect(typeof(emptyArray)).toBe(FILL_ME_IN); //A mistake? - http://javascript.crockford.com/remedial.html
@@ -18,13 +18,13 @@ describe("About Arrays", function() {
1818
it("should understand array literals", function () {
1919
var array = [];
2020
expect(array).toEqual([]);
21-
21+
2222
array[0] = 1;
2323
expect(array).toEqual([1]);
24-
24+
2525
array[1] = 2;
2626
expect(array).toEqual([1, FILL_ME_IN]);
27-
27+
2828
array.push(3);
2929
expect(array).toEqual(FILL_ME_IN);
3030
});
@@ -36,7 +36,7 @@ describe("About Arrays", function() {
3636
fourNumberArray.push(5, 6);
3737
expect(fourNumberArray.length).toBe(FILL_ME_IN);
3838

39-
var tenEmptyElementArray = new Array(10);
39+
var tenEmptyElementArray = new Array(10);
4040
expect(tenEmptyElementArray.length).toBe(FILL_ME_IN);
4141

4242
tenEmptyElementArray.length = 5;
@@ -45,7 +45,7 @@ describe("About Arrays", function() {
4545

4646
it("should slice arrays", function () {
4747
var array = ["peanut", "butter", "and", "jelly"];
48-
48+
4949
expect(array.slice(0, 1)).toEqual(FILL_ME_IN);
5050
expect(array.slice(0, 2)).toEqual(FILL_ME_IN);
5151
expect(array.slice(2, 2)).toEqual(FILL_ME_IN);
@@ -78,7 +78,7 @@ describe("About Arrays", function() {
7878
array.push(3);
7979

8080
expect(array).toEqual(FILL_ME_IN);
81-
81+
8282
var poppedValue = array.pop();
8383
expect(poppedValue).toBe(FILL_ME_IN);
8484
expect(array).toEqual(FILL_ME_IN);
@@ -89,9 +89,9 @@ describe("About Arrays", function() {
8989

9090
array.unshift(3);
9191
expect(array).toEqual(FILL_ME_IN);
92-
92+
9393
var shiftedValue = array.shift();
9494
expect(shiftedValue).toEqual(FILL_ME_IN);
9595
expect(array).toEqual(FILL_ME_IN);
96-
});
96+
});
9797
});

koans/AboutExpects.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
describe("About Expects", function() {
22

3-
//We shall contemplate truth by testing reality, via spec expectations.
3+
//We shall contemplate truth by testing reality, via spec expectations.
44
it("should expect true", function() {
55
expect(false).toBeTruthy(); //This should be true
66
});
77

88
//To understand reality, we must compare our expectations against reality.
9-
it("should expect equality", function () {
10-
var expectedValue = FILL_ME_IN;
11-
var actualValue = 1 + 1;
12-
13-
expect(actualValue === expectedValue).toBeTruthy();
14-
});
9+
it("should expect equality", function () {
10+
var expectedValue = FILL_ME_IN;
11+
var actualValue = 1 + 1;
12+
13+
expect(actualValue === expectedValue).toBeTruthy();
14+
});
1515

1616
//Some ways of asserting equality are better than others.
17-
it("should assert equality a better way", function () {
18-
var expectedValue = FILL_ME_IN;
19-
var actualValue = 1 + 1;
20-
17+
it("should assert equality a better way", function () {
18+
var expectedValue = FILL_ME_IN;
19+
var actualValue = 1 + 1;
20+
2121
// toEqual() compares using common sense equality.
22-
expect(actualValue).toEqual(expectedValue);
22+
expect(actualValue).toEqual(expectedValue);
2323
});
2424

2525
//Sometimes you need to be really exact about what you "type".
26-
it("should assert equality with ===", function () {
27-
var expectedValue = FILL_ME_IN;
28-
var actualValue = (1 + 1).toString();
29-
26+
it("should assert equality with ===", function () {
27+
var expectedValue = FILL_ME_IN;
28+
var actualValue = (1 + 1).toString();
29+
3030
// toBe() will always use === to compare.
31-
expect(actualValue).toBe(expectedValue);
32-
});
31+
expect(actualValue).toBe(expectedValue);
32+
});
3333

3434
//Sometimes we will ask you to fill in the values.
3535
it("should have filled in values", function () {
36-
expect(1 + 1).toEqual(FILL_ME_IN);
36+
expect(1 + 1).toEqual(FILL_ME_IN);
3737
});
3838
});

koans/AboutFunctions.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
describe("About Functions", function() {
22

33
it("should declare functions", function() {
4-
4+
55
function add(a, b) {
66
return a + b;
77
}
8-
8+
99
expect(add(1, 2)).toBe(FILL_ME_IN);
1010
});
1111

1212
it("should know internal variables override outer variables", function () {
1313
var message = "Outer";
14-
14+
1515
function getMessage() {
1616
return message;
1717
}
18-
18+
1919
function overrideMessage() {
2020
var message = "Inner";
2121
return message;
2222
}
23-
23+
2424
expect(getMessage()).toBe(FILL_ME_IN);
2525
expect(overrideMessage()).toBe(FILL_ME_IN);
2626
expect(message).toBe(FILL_ME_IN);
@@ -56,27 +56,27 @@ describe("About Functions", function() {
5656
});
5757

5858
it("should allow extra function arguments", function () {
59-
59+
6060
function returnFirstArg(firstArg) {
6161
return firstArg;
6262
}
63-
63+
6464
expect(returnFirstArg("first", "second", "third")).toBe(FILL_ME_IN);
65-
65+
6666
function returnSecondArg(firstArg, secondArg) {
6767
return secondArg;
6868
}
69-
69+
7070
expect(returnSecondArg("only give first arg")).toBe(FILL_ME_IN);
71-
71+
7272
function returnAllArgs() {
7373
var argsArray = [];
7474
for (var i = 0; i < arguments.length; i += 1) {
7575
argsArray.push(arguments[i]);
7676
}
7777
return argsArray.join(",");
7878
}
79-
79+
8080
expect(returnAllArgs("first", "second", "third")).toBe(FILL_ME_IN);
8181
});
8282

@@ -85,27 +85,27 @@ describe("About Functions", function() {
8585
var appendRules = function (name) {
8686
return name + " rules!";
8787
};
88-
88+
8989
var appendDoubleRules = function (name) {
9090
return name + " totally rules!";
9191
};
92-
92+
9393
var praiseSinger = { givePraise: appendRules };
9494
expect(praiseSinger.givePraise("John")).toBe(FILL_ME_IN);
95-
95+
9696
praiseSinger.givePraise = appendDoubleRules;
9797
expect(praiseSinger.givePraise("Mary")).toBe(FILL_ME_IN);
98-
98+
9999
});
100100

101101
it("should use function body as a string", function () {
102102
var add = new Function("a", "b", "return a + b;");
103103
expect(add(1, 2)).toBe(FILL_ME_IN);
104-
104+
105105
var multiply = function (a, b) {
106106
//An internal comment
107107
return a * b;
108108
};
109109
expect(multiply.toString()).toBe(FILL_ME_IN);
110-
});
110+
});
111111
});

koans/AboutHigherOrderFunctions.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ describe("About Higher Order Functions", function () {
1010
it("should use filter to return array items that meet a criteria", function () {
1111
var numbers = [1,2,3];
1212
var odd = _(numbers).filter(function (x) { return x % 2 !== 0 });
13-
13+
1414
expect(odd).toEqual(FILL_ME_IN);
1515
expect(odd.length).toBe(FILL_ME_IN);
1616
expect(numbers.length).toBe(FILL_ME_IN);
1717
});
18-
18+
1919
it("should use 'map' to transform each element", function () {
2020
var numbers = [1, 2, 3];
2121
var numbersPlus1 = _(numbers).map(function(x) { return x + 1 });
22-
22+
2323
expect(numbersPlus1).toEqual(FILL_ME_IN);
2424
expect(numbers).toEqual(FILL_ME_IN);
2525
});
26-
26+
2727
it("should use 'reduce' to update the same result on each iteration", function () {
2828
var numbers = [1, 2, 3];
2929
var reduction = _(numbers).reduce(
3030
function(/* result from last call */ memo, /* current */ x) { return memo + x }, /* initial */ 0);
31-
31+
3232
expect(reduction).toBe(FILL_ME_IN);
3333
expect(numbers).toEqual(FILL_ME_IN);
3434
});
35-
35+
3636
it("should use 'forEach' for simple iteration", function () {
3737
var numbers = [1,2,3];
3838
var msg = "";
@@ -41,11 +41,11 @@ describe("About Higher Order Functions", function () {
4141
};
4242

4343
_(numbers).forEach(isEven);
44-
44+
4545
expect(msg).toEqual(FILL_ME_IN);
4646
expect(numbers).toEqual(FILL_ME_IN);
4747
});
48-
48+
4949
it("should use 'all' to test whether all items pass condition", function () {
5050
var onlyEven = [2,4,6];
5151
var mixedBag = [2,4,5,6];
@@ -55,7 +55,7 @@ describe("About Higher Order Functions", function () {
5555
expect(_(onlyEven).all(isEven)).toBe(FILL_ME_IN);
5656
expect(_(mixedBag).all(isEven)).toBe(FILL_ME_IN);
5757
});
58-
58+
5959
it("should use 'any' to test if any items passes condition" , function () {
6060
var onlyEven = [2,4,6];
6161
var mixedBag = [2,4,5,6];

0 commit comments

Comments
 (0)