Skip to content

Commit 6b28d5e

Browse files
author
Matt Gaunt
committed
Tested on 0.10
1 parent d42619f commit 6b28d5e

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

test/test-cli.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515

1616
suite('Test Encryption Helpers', function() {
1717
test('no args run', function() {
18-
return new Promise(resolve => {
18+
return new Promise(function(resolve) {
1919
const webpushCLISpawn = spawn('node', [
2020
cliPath
2121
]);
2222
let errorData = '';
2323
let consoleOutput = '';
24-
webpushCLISpawn.stdout.on('data', data => {
24+
webpushCLISpawn.stdout.on('data', function(data) {
2525
consoleOutput += data;
2626
});
2727

28-
webpushCLISpawn.stderr.on('data', data => {
28+
webpushCLISpawn.stderr.on('data', function(data) {
2929
errorData += data;
3030
});
3131

32-
webpushCLISpawn.on('close', code => {
32+
webpushCLISpawn.on('close', function(code) {
3333
// No args should have code 1
3434
assert(code, 1);
3535

@@ -42,13 +42,13 @@
4242
});
4343

4444
test('test send-notification no args', function() {
45-
return new Promise(resolve => {
45+
return new Promise(function(resolve) {
4646
const webpushCLISpawn = spawn('node', [
4747
cliPath,
4848
'send-notification'
4949
]);
5050

51-
webpushCLISpawn.on('close', code => {
51+
webpushCLISpawn.on('close', function(code) {
5252
// No args should have code 1
5353
assert.equal(code, 1);
5454
resolve();
@@ -57,7 +57,7 @@
5757
});
5858

5959
test('test send-notification only endpoint', function() {
60-
return new Promise(resolve => {
60+
return new Promise(function(resolve) {
6161
const webpushCLISpawn = spawn('node', [
6262
cliPath,
6363
'send-notification',
@@ -66,15 +66,15 @@
6666

6767
let errorData = '';
6868
let consoleOutput = '';
69-
webpushCLISpawn.stdout.on('data', data => {
69+
webpushCLISpawn.stdout.on('data', function(data) {
7070
consoleOutput += data;
7171
});
7272

73-
webpushCLISpawn.stderr.on('data', data => {
73+
webpushCLISpawn.stderr.on('data', function(data) {
7474
errorData += data;
7575
});
7676

77-
webpushCLISpawn.on('close', code => {
77+
webpushCLISpawn.on('close', function(code) {
7878
assert.equal(code, 0);
7979
assert.equal(errorData, '');
8080
assert.equal(consoleOutput.indexOf('Error sending push message: '), 0);
@@ -84,7 +84,7 @@
8484
});
8585

8686
test('test send-notification all options', function() {
87-
return new Promise(resolve => {
87+
return new Promise(function(resolve) {
8888
const webpushCLISpawn = spawn('node', [
8989
cliPath,
9090
'send-notification',
@@ -101,15 +101,15 @@
101101

102102
let errorData = '';
103103
let consoleOutput = '';
104-
webpushCLISpawn.stdout.on('data', data => {
104+
webpushCLISpawn.stdout.on('data', function(data) {
105105
consoleOutput += data;
106106
});
107107

108-
webpushCLISpawn.stderr.on('data', data => {
108+
webpushCLISpawn.stderr.on('data', function(data) {
109109
errorData += data;
110110
});
111111

112-
webpushCLISpawn.on('close', code => {
112+
webpushCLISpawn.on('close', function(code) {
113113
assert.equal(code, 0);
114114
assert.equal(errorData, '');
115115
assert.equal(consoleOutput.indexOf('Error sending push message: '), 0);
@@ -119,36 +119,36 @@
119119
});
120120

121121
test('test generate vapid keys', function() {
122-
return new Promise(resolve => {
122+
return new Promise(function(resolve) {
123123
const webpushCLISpawn = spawn('node', [
124124
cliPath,
125125
'generate-vapid-keys'
126126
]);
127127

128128
let errorData = '';
129129
let consoleOutput = '';
130-
webpushCLISpawn.stdout.on('data', data => {
130+
webpushCLISpawn.stdout.on('data', function(data) {
131131
consoleOutput += data;
132132
});
133133

134-
webpushCLISpawn.stderr.on('data', data => {
134+
webpushCLISpawn.stderr.on('data', function(data) {
135135
errorData += data;
136136
});
137137

138-
webpushCLISpawn.on('close', code => {
138+
webpushCLISpawn.on('close', function(code) {
139139
assert.equal(code, 0);
140140
assert.equal(errorData, '');
141141
assert.notEqual(consoleOutput.indexOf('Public Key:'), -1);
142142
assert.notEqual(consoleOutput.indexOf('Private Key:'), -1);
143143

144144
const lines = consoleOutput.split('\n');
145-
const publicKeyTitleIndex = lines.findIndex(line => {
145+
const publicKeyTitleIndex = lines.findIndex(function(line) {
146146
return line.indexOf('Public Key:') !== -1;
147147
});
148148
const publicKey = lines[publicKeyTitleIndex + 1].trim();
149149
assert.equal(urlBase64.decode(publicKey).length, 65);
150150

151-
const privateKeyTitleIndex = lines.findIndex(line => {
151+
const privateKeyTitleIndex = lines.findIndex(function(line) {
152152
return line.indexOf('Private Key:') !== -1;
153153
});
154154
const privateKey = lines[privateKeyTitleIndex + 1].trim();
@@ -159,7 +159,7 @@
159159
});
160160

161161
test('test generate JSON vapid keys', function() {
162-
return new Promise(resolve => {
162+
return new Promise(function(resolve) {
163163
const webpushCLISpawn = spawn('node', [
164164
cliPath,
165165
'generate-vapid-keys',
@@ -168,15 +168,15 @@
168168

169169
let errorData = '';
170170
let consoleOutput = '';
171-
webpushCLISpawn.stdout.on('data', data => {
171+
webpushCLISpawn.stdout.on('data', function(data) {
172172
consoleOutput += data;
173173
});
174174

175-
webpushCLISpawn.stderr.on('data', data => {
175+
webpushCLISpawn.stderr.on('data', function(data) {
176176
errorData += data;
177177
});
178178

179-
webpushCLISpawn.on('close', code => {
179+
webpushCLISpawn.on('close', function(code) {
180180
assert.equal(code, 0);
181181
assert.equal(errorData, '');
182182

0 commit comments

Comments
 (0)