Skip to content

Commit 53634f2

Browse files
author
Kuniwak
committed
Use better assertions
1 parent f8bb548 commit 53634f2

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

public/stage5/tests.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ describe('ステージ5(意図通りに非同期処理を利用できる)',
7474
// });
7575

7676

77-
return expect(promisedFriends).to.eventually.deep.equal(['PYXC-PJ']);
77+
return expect(promisedFriends).to.eventually.have.length(1)
78+
.and.have.members(['PYXC-PJ']);
7879
});
7980

8081

@@ -86,9 +87,8 @@ describe('ステージ5(意図通りに非同期処理を利用できる)',
8687
var promisedFriends = 'change me!';
8788

8889

89-
return expect(promisedFriends).to.eventually.deep.equal(
90-
['jisp', 'TeJaS']
91-
);
90+
return expect(promisedFriends).to.eventually.have.length(2)
91+
.and.have.members(['jisp', 'TeJaS']);
9292
});
9393

9494

@@ -100,7 +100,8 @@ describe('ステージ5(意図通りに非同期処理を利用できる)',
100100
var promisedFriends = 'change me!';
101101

102102

103-
return expect(promisedFriends).to.eventually.deep.equal(['TypeScript']);
103+
return expect(promisedFriends).to.eventually.have.length(1)
104+
.and.have.members(['TypeScript']);
104105
});
105106

106107

@@ -112,9 +113,14 @@ describe('ステージ5(意図通りに非同期処理を利用できる)',
112113
var promisedFriends = 'change me!';
113114

114115

115-
return expect(promisedFriends).to.eventually.deep.equal(
116-
['Taijilang', 'purescript', 'Wind.js', 'ScriptBlocks', 'jangaroo']
117-
);
116+
return expect(promisedFriends).to.eventually.have.length(5)
117+
.and.have.members([
118+
'Taijilang',
119+
'purescript',
120+
'Wind.js',
121+
'ScriptBlocks',
122+
'jangaroo'
123+
]);
118124
});
119125

120126

@@ -152,7 +158,8 @@ describe('ステージ5(意図通りに非同期処理を利用できる)',
152158
// 作成した promise を mostPopularRepos 変数に代入してください。
153159

154160

155-
return expect(mostPopularRepos).to.eventually.have.length(2);
161+
return expect(mostPopularRepos).to.eventually.have.length(2)
162+
.and.satisfy(function(name) { return typeof name === 'string'; });
156163

157164
// Github API に関する参考情報
158165
// https://developer.github.com/v3/search

0 commit comments

Comments
 (0)