Skip to content

Commit a5d0aff

Browse files
author
Olha Virolainen
authored
Fix unittests (#43)
* Fix unittest * Update sailor version to 2.6.18
1 parent 492cd22 commit a5d0aff

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.2.7 (October 27, 2020)
2+
* Update sailor version to 2.6.18
3+
* Fix unit-tests
4+
15
## 1.2.6 (October 19, 2020)
26
* Update sailor version to 2.6.17
37

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webhook",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"description": "elastic.io webhook component",
55
"scripts": {
66
"pretest": "eslint spec lib verifyCredentials.js --fix",
@@ -13,7 +13,7 @@
1313
"license": "Apache License 2.0",
1414
"dependencies": {
1515
"elasticio-node": "0.0.9",
16-
"elasticio-sailor-nodejs": "2.6.17",
16+
"elasticio-sailor-nodejs": "2.6.18",
1717
"node-uuid": "1.4.8",
1818
"request": "2.88.x"
1919
},

spec/webhook.spec.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Test Webhook', () => {
1515
const webhookReturnObj = { message: 'ok', other: 'returned' };
1616
let self;
1717

18-
it('PUT No Auth', () => {
18+
it('PUT No Auth', (done) => {
1919
const nockObj = nock('http://www.example.com')
2020
.put('/test', {
2121
k1: 'v1',
@@ -52,10 +52,11 @@ describe('Test Webhook', () => {
5252
expect(self.calledTwice).to.be.true;
5353
expect(self.args[0][1].body).to.eql(webhookReturnObj);
5454
expect(self.args[1][0]).to.eql('end');
55+
done();
5556
});
5657
});
5758

58-
it('PUT Auth', () => {
59+
it('PUT Auth', (done) => {
5960
const nockObj = nock('http://www.example.com')
6061
.put('/test', {
6162
k1: 'v1',
@@ -94,10 +95,11 @@ describe('Test Webhook', () => {
9495
expect(self.calledTwice).to.be.true;
9596
expect(self.args[0][1].body).to.eql(webhookReturnObj);
9697
expect(self.args[1][0]).to.eql('end');
98+
done();
9799
});
98100
});
99101

100-
it('POST and get text/html response', () => {
102+
it('POST and get text/html response', (done) => {
101103
const nockObj = nock('http://www.example.com')
102104
.post('/test', {
103105
k1: 'v1',
@@ -135,10 +137,11 @@ describe('Test Webhook', () => {
135137
responseBody: '{"message":"ok","other":"returned"}',
136138
});
137139
expect(self.args[1][0]).to.eql('end');
140+
done();
138141
});
139142
});
140143

141-
it('GET No Auth No QMark', () => {
144+
it('GET No Auth No QMark', (done) => {
142145
const nockObj = nock('http://www.example.com')
143146
.get('/test?k1=v1&k2=v2')
144147
.reply(200, webhookReturnObj);
@@ -172,10 +175,11 @@ describe('Test Webhook', () => {
172175
expect(self.args[0][0]).to.eql('data');
173176
expect(self.args[0][1].body).to.eql(webhookReturnObj);
174177
expect(self.args[1][0]).to.eql('end');
178+
done();
175179
});
176180
});
177181

178-
it('GET Auth QMark', () => {
182+
it('GET Auth QMark', (done) => {
179183
const nockObj = nock('http://www.example.com')
180184
.get('/test?k1=v1&k2=v2')
181185
.matchHeader('X-Api-Secret', 'theSecret')
@@ -213,10 +217,11 @@ describe('Test Webhook', () => {
213217
expect(self.args[0][0]).to.eql('data');
214218
expect(self.args[0][1].body).to.eql(webhookReturnObj);
215219
expect(self.args[1][0]).to.eql('end');
220+
done();
216221
});
217222
});
218223

219-
it('404', () => {
224+
it('404', (done) => {
220225
const nockObj = nock('http://www.example.com')
221226
.get('/test?k1=v1&k2=v2')
222227
.matchHeader('X-Api-Secret', 'theSecret')
@@ -252,6 +257,7 @@ describe('Test Webhook', () => {
252257
expect(self.args[0][0]).to.eql('error');
253258
expect(self.args[0][1].message).to.eql('Endpoint responds with 404');
254259
expect(self.args[1][0]).to.eql('end');
260+
done();
255261
});
256262
});
257263

0 commit comments

Comments
 (0)