Skip to content

Commit e21ccf8

Browse files
committed
Remarks from @bvidis
1 parent da35f9a commit e21ccf8

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

test/kuzzle/constructor.test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,9 @@ describe('Kuzzle constructor', () => {
212212
});
213213

214214
it('should throw an error if no URL is provided', () => {
215-
try {
215+
should(() => {
216216
new Kuzzle();
217-
}
218-
catch (e) {
219-
return;
220-
}
221-
should.fail('success', 'failure', 'Constructor should fail with no URL provided', '');
217+
}).throw();
222218
});
223219

224220
describe('#connect', function () {

test/kuzzle/listenersManagement.test.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,15 @@ describe('Listeners management', () => {
3535
});
3636

3737
it('should throw an error if trying to adding a listener to an unknown event', function () {
38-
try {
38+
should(() => {
3939
kuzzle.addListener('foo', function () {});
40-
}
41-
catch (e) {
42-
return;
43-
}
44-
45-
should.fail('success', 'failure', 'Should have failed to add a listener to unknown event "foo"', '');
40+
}).throw();
4641
});
4742

4843
it('should throw an error when providing a non-function listener argument', function () {
49-
try {
44+
should(() => {
5045
kuzzle.addListener('connected', 'bar');
51-
}
52-
catch (e) {
53-
return;
54-
}
55-
56-
should.fail('success', 'failure', 'Should have failed to add a string listener', '');
46+
}).throw();
5747
});
5848
});
5949

0 commit comments

Comments
 (0)