Skip to content

Commit 8dcf2f1

Browse files
committed
Update order for assertion tests
1 parent 2c62468 commit 8dcf2f1

File tree

4 files changed

+161
-126
lines changed

4 files changed

+161
-126
lines changed

Diff for: filter/core.spec.js

+23-12
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,43 @@ var assert = require('assert'),
44
describe('Filter', function() {
55
describe('#onlyEven()', function () {
66
it('returns only those numbers that are even', function () {
7-
var array = [10,15,20,25,30,35];
8-
assert.deepEqual([10,20,30], core.onlyEven(array));
7+
var input = [ 10, 15, 20, 25, 30, 35 ];
8+
var expected = [ 10, 20, 30 ]
9+
var actual = core.onlyEven(input)
10+
11+
assert.deepEqual(actual, expected);
912
});
1013
});
1114

1215
describe('#onlyOneWord()', function () {
1316
it('returns only those strings with a single word (no spaces)', function () {
14-
var array = ['return', 'phrases', 'with one word'];
15-
assert.deepEqual(['return', 'phrases'], core.onlyOneWord(array));
17+
var input = [ 'return', 'phrases', 'with one word' ];
18+
var expected = [ 'return', 'phrases' ]
19+
var actual = core.onlyOneWord(input)
20+
21+
assert.deepEqual(actual, expected);
1622
});
1723
});
1824

1925
describe('#positiveRowsOnly()', function () {
2026
it('return only the rows in the matrix that have all positive integers', function () {
21-
var matrix = [[1, 10,-100],
22-
[2,-20, 200],
23-
[3, 30, 300]];
24-
var result = [[3, 30, 300]];
25-
assert.deepEqual(result, core.positiveRowsOnly(matrix));
27+
var input = [[ 1, 10, -100 ],
28+
[ 2, -20, 200 ],
29+
[ 3, 30, 300 ]];
30+
var expected = [[ 3, 30, 300 ]];
31+
var actual = core.positiveRowsOnly(input)
32+
33+
assert.deepEqual(actual, expected);
2634
});
2735
});
2836

2937
describe('#allSameVowels()', function () {
3038
it('return only those words where all the vowels are the same', function () {
31-
var array = ['racecar', 'amalgam', 'oligopoly', 'zoom'];
32-
assert.deepEqual(['amalgam', 'zoom'], core.allSameVowels(array));
39+
var input = [ 'racecar', 'amalgam', 'oligopoly', 'zoom' ];
40+
var expected = [ 'amalgam', 'zoom' ]
41+
var actual = core.allSameVowels(input)
42+
43+
assert.deepEqual(actual, expected);
3344
});
3445
});
35-
});
46+
});

Diff for: map/core.spec.js

+25-14
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,45 @@ var assert = require('assert'),
44
describe('Map', function() {
55
describe('#multiplyBy10()', function () {
66
it('multiplies all elements in an array by 10', function () {
7-
var array = [45, 1, -10, 11, 250];
8-
assert.deepEqual([450, 10, -100, 110, 2500], core.multiplyBy10(array));
7+
var input = [ 45, 1, -10, 11, 250 ]
8+
var expected = [ 450, 10, -100, 110, 2500 ]
9+
var actual = core.multiplyBy10(input)
10+
11+
assert.deepEqual(actual, expected);
912
});
1013
});
1114

1215
describe('#shiftRight()', function () {
1316
it('shifts items in an array to the right by one', function () {
14-
var array = [{ name: '' }, 10, "left-side"];
15-
assert.deepEqual(["left-side", { name: '' }, 10], core.shiftRight(array));
17+
var input = [ { name: '' }, 10, 'left-side' ];
18+
var expected = [ 'left-side', { name: '' }, 10 ]
19+
var actual = core.shiftRight(input)
20+
21+
assert.deepEqual(actual, expected);
1622
});
1723
});
1824

1925
describe('#onlyVowels()', function () {
2026
it('removes any non-vowel character from words in an array', function () {
21-
var array = ['average', 'exceptional', 'amazing'];
22-
assert.deepEqual(['aeae', 'eeioa', 'aai'], core.onlyVowels(array));
27+
var input = [ 'average', 'exceptional', 'amazing' ];
28+
var expected = [ 'aeae', 'eeioa', 'aai' ]
29+
var actual = core.onlyVowels(input)
30+
31+
assert.deepEqual(actual, expected);
2332
});
2433
});
2534

2635
describe('#doubleMatrix()', function () {
2736
it('doubles the numbers in the matrix, maintaining the same structure', function () {
28-
var matrix = [[1,2,3],
29-
[4,5,6],
30-
[7,8,9]];
31-
var result = [[2,4,6],
32-
[8,10,12],
33-
[14,16,18]];
34-
assert.deepEqual(result, core.doubleMatrix(matrix));
37+
var input = [[ 1, 2,3 ],
38+
[ 4, 5,6 ],
39+
[ 7, 8,9 ]];
40+
var expected = [[ 2, 4, 6],
41+
[ 8, 10, 12],
42+
[ 14, 16, 18]];
43+
var actual = core.doubleMatrix(input)
44+
45+
assert.deepEqual(actual, expected);
3546
});
3647
});
37-
});
48+
});

Diff for: reduce/core.spec.js

+28-18
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,47 @@ var assert = require('assert'),
44
describe('Reduce', function() {
55
describe('#sum()', function () {
66
it('sum all the numbers in the array', function () {
7-
var array = [10,15,20,25,30,35];
8-
assert.equal(135, core.sum(array));
7+
var input = [ 10, 15, 20, 25, 30, 35 ];
8+
var expected = 135
9+
var actual = core.sum(input)
10+
11+
assert.equal(actual, expected);
912
});
1013
});
1114

1215
describe('#productAll()', function () {
1316
it('return the product of all items in the matrix', function () {
14-
var matrix = [[1, 2, 3],
15-
[4, 5],
16-
[6]];
17-
assert.equal(720, core.productAll(matrix));
17+
var input = [[ 1, 2, 3 ],
18+
[ 4, 5 ],
19+
[ 6 ]];
20+
var expected = 720
21+
var actual = core.productAll(input)
22+
23+
assert.equal(actual, expected);
1824
});
1925
});
20-
26+
2127
describe('#objectify()', function () {
2228
it('turns an array of arrays into an object', function () {
23-
var matrix = [['Thundercats', '80s'],
24-
['The Powerpuff Girls', '90s'],
25-
['Sealab 2021', '00s']];
26-
var result = { 'Thundercats': '80s',
27-
'The Powerpuff Girls': '90s',
28-
'Sealab 2021': '00s' };
29-
assert.deepEqual(result, core.objectify(matrix));
29+
var input = [[ 'Thundercats', '80s' ],
30+
[ 'The Powerpuff Girls', '90s' ],
31+
[ 'Sealab 2021', '00s' ]];
32+
var expected = { 'Thundercats': '80s',
33+
'The Powerpuff Girls': '90s',
34+
'Sealab 2021': '00s' };
35+
var actual = core.objectify(input)
36+
37+
assert.equal(actual, expected);
3038
});
3139
});
3240

3341
describe('#luckyNumbers()', function () {
3442
it('return a fortune like sentence with lucky numbers', function () {
35-
var array = [30, 48, 11, 5, 32];
36-
var result = 'Your lucky numbers are: 30, 48, 11, 5, and 32';
37-
assert.equal(result, core.luckyNumbers(array));
43+
var input = [ 30, 48, 11, 5, 32 ];
44+
var expected = 'Your lucky numbers are: 30, 48, 11, 5, and 32';
45+
var actual = core.luckyNumbers(input)
46+
47+
assert.equal(actual, expected);
3848
});
3949
});
40-
});
50+
});

0 commit comments

Comments
 (0)