Skip to content

Commit 88d5a55

Browse files
authored
Merge pull request #145 from kuzzleio/feature-138-should-fail
Rewrite bad and obsolete tests
2 parents 9a713a9 + cbf6d55 commit 88d5a55

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

test/kuzzle/constructor.test.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -212,23 +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-
should.fail('success', 'failure', 'Constructor should fail with no URL provided', '');
218-
}
219-
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
231-
}
217+
}).throw();
232218
});
233219

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

test/kuzzle/listenersManagement.test.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +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-
should.fail('success', 'failure', 'Should have failed to add a listener to unknown event "foo"', '');
41-
}
42-
catch (e) {
43-
// done
44-
}
40+
}).throw();
4541
});
4642

4743
it('should throw an error when providing a non-function listener argument', function () {
48-
try {
44+
should(() => {
4945
kuzzle.addListener('connected', 'bar');
50-
should.fail('success', 'failure', 'Should have failed to add a string listener', '');
51-
}
52-
catch (e) {
53-
// done
54-
}
46+
}).throw();
5547
});
5648
});
5749

0 commit comments

Comments
 (0)