Skip to content

Commit 0758535

Browse files
committed
concat first run complete
1 parent 94cf7e7 commit 0758535

File tree

3 files changed

+43
-962
lines changed

3 files changed

+43
-962
lines changed

tutorial/1/06/04-concat.spec.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ if (!global.courses) {
1212

1313
describe('var suspectData', function() {
1414

15+
it('should have 10 items', function() {
16+
expect(suspectData).to.have.length.above(9);
17+
})
18+
1519
it('should filter if the `indexOf` the suspects name is greater than -1', function() {
16-
20+
if (suspectData.length === 10) {
21+
suspectData.forEach(function(suspect) {
22+
expect(suspect.name).to.equal('Hack Kerr');
23+
});
24+
}
1725
});
1826

1927
});

tutorial/1/06/05-concat.spec.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"use strict";
2+
var path = require('path');
3+
var chai = require('chai');
4+
var spies = require('chai-spies');
5+
var expect = chai.expect;
6+
chai.use(spies);
7+
var loadJS = require('../../common/loadJS').default;
8+
9+
if (!global.courses) {
10+
global.courses = JSON.parse(JSON.stringify(require('../../data/courses2.json')));
11+
}
12+
13+
describe('var suspectData', function() {
14+
15+
it('should filter if the `indexOf` the suspects name is greater than -1', function() {
16+
var result = courses.map(function(course) {
17+
return course.students.map(function(student) {
18+
return {
19+
title: course.title,
20+
instructor: course.instructor,
21+
name: student.name,
22+
score: student.score,
23+
grade: student.grade
24+
};
25+
});
26+
}).flatten();
27+
var suspects = ['Hack Kerr', 'Kevin Mitnick', 'Albert Gonzalez'];
28+
var suspectResult = result.filter(function(student) {
29+
return suspects.indexOf(student.name) > -1;
30+
});
31+
expect(suspectData).to.deep.equal(suspectResult);
32+
});
33+
34+
});

0 commit comments

Comments
 (0)