Skip to content

Commit da35f9a

Browse files
committed
Rewrite bad and obsolete tests
1 parent be17cba commit da35f9a

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

test/kuzzle/constructor.test.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,11 @@ describe('Kuzzle constructor', () => {
214214
it('should throw an error if no URL is provided', () => {
215215
try {
216216
new Kuzzle();
217-
should.fail('success', 'failure', 'Constructor should fail with no URL provided', '');
218217
}
219218
catch (e) {
220-
// done
221-
}
222-
});
223-
224-
it('should throw an error if no index is provied', () => {
225-
try {
226-
new Kuzzle('foo');
227-
should.fail('success', 'failure', 'Constructor should fail with no Index provided', '');
228-
}
229-
catch (e) {
230-
// done
219+
return;
231220
}
221+
should.fail('success', 'failure', 'Constructor should fail with no URL provided', '');
232222
});
233223

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

test/kuzzle/listenersManagement.test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,23 @@ describe('Listeners management', () => {
3737
it('should throw an error if trying to adding a listener to an unknown event', function () {
3838
try {
3939
kuzzle.addListener('foo', function () {});
40-
should.fail('success', 'failure', 'Should have failed to add a listener to unknown event "foo"', '');
4140
}
4241
catch (e) {
43-
// done
42+
return;
4443
}
44+
45+
should.fail('success', 'failure', 'Should have failed to add a listener to unknown event "foo"', '');
4546
});
4647

4748
it('should throw an error when providing a non-function listener argument', function () {
4849
try {
4950
kuzzle.addListener('connected', 'bar');
50-
should.fail('success', 'failure', 'Should have failed to add a string listener', '');
5151
}
5252
catch (e) {
53-
// done
53+
return;
5454
}
55+
56+
should.fail('success', 'failure', 'Should have failed to add a string listener', '');
5557
});
5658
});
5759

0 commit comments

Comments
 (0)