@@ -59,221 +59,221 @@ test(`startInstance: should accept application/json`, async (t) => {
59
59
const sample = getSample ( ) ;
60
60
mocks . req . method = `POST` ;
61
61
mocks . req . headers [ `content-type` ] = `application/json` ;
62
- mocks . req . body = { zone :`test-zone` , instance :`test-instance` } ;
62
+ mocks . req . body = { zone : `test-zone` , instance : `test-instance` } ;
63
63
sample . program . startInstance ( mocks . req , mocks . res ) ;
64
64
65
65
sample . mocks . requestPromise ( )
66
- . then ( ( data ) => {
67
- // The request was successfully sent.
68
- t . deepEqual ( data , 'request sent' ) ;
69
- } ) ;
66
+ . then ( ( data ) => {
67
+ // The request was successfully sent.
68
+ t . deepEqual ( data , 'request sent' ) ;
69
+ } ) ;
70
70
} ) ;
71
71
72
72
test ( `startInstance: should accept application/octect-stream` , async ( t ) => {
73
73
const mocks = getMocks ( ) ;
74
74
const sample = getSample ( ) ;
75
75
mocks . req . method = `POST` ;
76
76
mocks . req . headers [ `content-type` ] = `application/octet-stream` ;
77
- mocks . req . body = Buffer . from ( `{'zone':'test-zone', 'instance':'test-instance'}` ) ;
77
+ mocks . req . body = Buffer . from ( `{'zone': 'test-zone', 'instance': 'test-instance'}` ) ;
78
78
sample . program . startInstance ( mocks . req , mocks . res ) ;
79
79
80
80
sample . mocks . requestPromise ( )
81
- . then ( ( data ) => {
82
- // The request was successfully sent.
83
- t . deepEqual ( data , 'request sent' ) ;
84
- } ) ;
81
+ . then ( ( data ) => {
82
+ // The request was successfully sent.
83
+ t . deepEqual ( data , 'request sent' ) ;
84
+ } ) ;
85
85
} ) ;
86
86
87
87
test ( `startInstance: should fail missing HTTP request method` , async ( t ) => {
88
88
const mocks = getMocks ( ) ;
89
89
const sample = getSample ( ) ;
90
90
mocks . req . headers [ `content-type` ] = `application/json` ;
91
- mocks . req . body = { " zone" : " test-zone" , " instance" : " test-instance" } ;
91
+ mocks . req . body = { ' zone' : ' test-zone' , ' instance' : ' test-instance' } ;
92
92
sample . program . startInstance ( mocks . req , mocks . res ) ;
93
93
94
94
t . true ( mocks . res . status . calledOnce ) ;
95
95
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
96
96
t . true ( mocks . res . send . calledOnce ) ;
97
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :'Unsupported HTTP method undefined; use method POST' } ) ;
97
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : 'Unsupported HTTP method undefined; use method POST' } ) ;
98
98
} ) ;
99
99
100
100
test ( `startInstance: should reject HTTP GET request` , async ( t ) => {
101
101
const mocks = getMocks ( ) ;
102
102
const sample = getSample ( ) ;
103
103
mocks . req . method = `GET` ;
104
104
mocks . req . headers [ `content-type` ] = `application/json` ;
105
- mocks . req . body = { " zone" : " test-zone" , " instance" : " test-instance" } ;
105
+ mocks . req . body = { ' zone' : ' test-zone' , ' instance' : ' test-instance' } ;
106
106
sample . program . startInstance ( mocks . req , mocks . res ) ;
107
107
108
108
t . true ( mocks . res . status . calledOnce ) ;
109
109
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
110
110
t . true ( mocks . res . send . calledOnce ) ;
111
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :'Unsupported HTTP method GET; use method POST' } ) ;
111
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : 'Unsupported HTTP method GET; use method POST' } ) ;
112
112
} ) ;
113
113
114
114
test ( `startInstance: should fail missing content-type header` , async ( t ) => {
115
115
const mocks = getMocks ( ) ;
116
116
const sample = getSample ( ) ;
117
117
mocks . req . method = `POST` ;
118
- mocks . req . body = { " zone" : " test-zone" , " instance" : " test-instance" } ;
118
+ mocks . req . body = { ' zone' : ' test-zone' , ' instance' : ' test-instance' } ;
119
119
sample . program . startInstance ( mocks . req , mocks . res ) ;
120
120
121
121
t . true ( mocks . res . status . calledOnce ) ;
122
122
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
123
123
t . true ( mocks . res . send . calledOnce ) ;
124
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :'HTTP content-type missing' } ) ;
124
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : 'HTTP content-type missing' } ) ;
125
125
} ) ;
126
126
127
127
test ( `startInstance: should reject unsupported HTTP content-type` , async ( t ) => {
128
128
const mocks = getMocks ( ) ;
129
129
const sample = getSample ( ) ;
130
130
mocks . req . method = `POST` ;
131
131
mocks . req . headers [ `content-type` ] = `text/plain` ;
132
- mocks . req . body = { " zone" : " test-zone" , " instance" : " test-instance" } ;
132
+ mocks . req . body = { ' zone' : ' test-zone' , ' instance' : ' test-instance' } ;
133
133
sample . program . startInstance ( mocks . req , mocks . res ) ;
134
134
135
135
t . true ( mocks . res . status . calledOnce ) ;
136
136
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
137
137
t . true ( mocks . res . send . calledOnce ) ;
138
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :'Unsupported HTTP content-type text/plain; use application/json or application/octet-stream' } ) ;
138
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : 'Unsupported HTTP content-type text/plain; use application/json or application/octet-stream' } ) ;
139
139
} ) ;
140
140
141
141
test ( `startInstance: should fail with missing 'zone' attribute` , async ( t ) => {
142
142
const mocks = getMocks ( ) ;
143
143
const sample = getSample ( ) ;
144
144
mocks . req . method = `POST` ;
145
145
mocks . req . headers [ `content-type` ] = `application/json` ;
146
- mocks . req . body = { " instance" : " test-instance" } ;
146
+ mocks . req . body = { ' instance' : ' test-instance' } ;
147
147
sample . program . startInstance ( mocks . req , mocks . res ) ;
148
148
149
149
t . true ( mocks . res . status . calledOnce ) ;
150
150
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
151
151
t . true ( mocks . res . send . calledOnce ) ;
152
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :`Attribute 'zone' missing from POST request` } ) ;
152
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : `Attribute 'zone' missing from POST request` } ) ;
153
153
} ) ;
154
154
155
155
test ( `startInstance: should fail with missing 'instance' attribute` , async ( t ) => {
156
156
const mocks = getMocks ( ) ;
157
157
const sample = getSample ( ) ;
158
158
mocks . req . method = `POST` ;
159
159
mocks . req . headers [ `content-type` ] = `application/json` ;
160
- mocks . req . body = { " zone" : " test-zone" } ;
160
+ mocks . req . body = { ' zone' : ' test-zone' } ;
161
161
sample . program . startInstance ( mocks . req , mocks . res ) ;
162
162
163
163
t . true ( mocks . res . status . calledOnce ) ;
164
164
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
165
165
t . true ( mocks . res . send . calledOnce ) ;
166
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :`Attribute 'instance' missing from POST request` } ) ;
166
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : `Attribute 'instance' missing from POST request` } ) ;
167
167
} ) ;
168
168
169
169
test ( `stopInstance: should accept application/json` , async ( t ) => {
170
170
const mocks = getMocks ( ) ;
171
171
const sample = getSample ( ) ;
172
172
mocks . req . method = `POST` ;
173
173
mocks . req . headers [ `content-type` ] = `application/json` ;
174
- mocks . req . body = { zone :`test-zone` , instance :`test-instance` } ;
174
+ mocks . req . body = { zone : `test-zone` , instance : `test-instance` } ;
175
175
sample . program . stopInstance ( mocks . req , mocks . res ) ;
176
176
177
177
sample . mocks . requestPromise ( )
178
- . then ( ( data ) => {
179
- // The request was successfully sent.
180
- t . deepEqual ( data , 'request sent' ) ;
181
- } ) ;
178
+ . then ( ( data ) => {
179
+ // The request was successfully sent.
180
+ t . deepEqual ( data , 'request sent' ) ;
181
+ } ) ;
182
182
} ) ;
183
183
184
184
test ( `stopInstance: should accept application/octect-stream` , async ( t ) => {
185
185
const mocks = getMocks ( ) ;
186
186
const sample = getSample ( ) ;
187
187
mocks . req . method = `POST` ;
188
188
mocks . req . headers [ `content-type` ] = `application/octet-stream` ;
189
- mocks . req . body = Buffer . from ( `{'zone':'test-zone', 'instance':'test-instance'}` ) ;
189
+ mocks . req . body = Buffer . from ( `{'zone': 'test-zone', 'instance': 'test-instance'}` ) ;
190
190
sample . program . stopInstance ( mocks . req , mocks . res ) ;
191
191
192
192
sample . mocks . requestPromise ( )
193
- . then ( ( data ) => {
194
- // The request was successfully sent.
195
- t . deepEqual ( data , 'request sent' ) ;
196
- } ) ;
193
+ . then ( ( data ) => {
194
+ // The request was successfully sent.
195
+ t . deepEqual ( data , 'request sent' ) ;
196
+ } ) ;
197
197
} ) ;
198
198
199
199
test ( `stopInstance: should fail missing HTTP request method` , async ( t ) => {
200
200
const mocks = getMocks ( ) ;
201
201
const sample = getSample ( ) ;
202
202
mocks . req . headers [ `content-type` ] = `application/json` ;
203
- mocks . req . body = { " zone" : " test-zone" , " instance" : " test-instance" } ;
203
+ mocks . req . body = { ' zone' : ' test-zone' , ' instance' : ' test-instance' } ;
204
204
sample . program . stopInstance ( mocks . req , mocks . res ) ;
205
205
206
206
t . true ( mocks . res . status . calledOnce ) ;
207
207
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
208
208
t . true ( mocks . res . send . calledOnce ) ;
209
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :'Unsupported HTTP method undefined; use method POST' } ) ;
209
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : 'Unsupported HTTP method undefined; use method POST' } ) ;
210
210
} ) ;
211
211
212
212
test ( `stopInstance: should reject HTTP GET request` , async ( t ) => {
213
213
const mocks = getMocks ( ) ;
214
214
const sample = getSample ( ) ;
215
215
mocks . req . method = `GET` ;
216
216
mocks . req . headers [ `content-type` ] = `application/json` ;
217
- mocks . req . body = { " zone" : " test-zone" , " instance" : " test-instance" } ;
217
+ mocks . req . body = { ' zone' : ' test-zone' , ' instance' : ' test-instance' } ;
218
218
sample . program . stopInstance ( mocks . req , mocks . res ) ;
219
219
220
220
t . true ( mocks . res . status . calledOnce ) ;
221
221
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
222
222
t . true ( mocks . res . send . calledOnce ) ;
223
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :'Unsupported HTTP method GET; use method POST' } ) ;
223
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : 'Unsupported HTTP method GET; use method POST' } ) ;
224
224
} ) ;
225
225
226
226
test ( `stopInstance: should fail missing content-type header` , async ( t ) => {
227
227
const mocks = getMocks ( ) ;
228
228
const sample = getSample ( ) ;
229
229
mocks . req . method = `POST` ;
230
- mocks . req . body = { " zone" : " test-zone" , " instance" : " test-instance" } ;
230
+ mocks . req . body = { ' zone' : ' test-zone' , ' instance' : ' test-instance' } ;
231
231
sample . program . stopInstance ( mocks . req , mocks . res ) ;
232
232
233
233
t . true ( mocks . res . status . calledOnce ) ;
234
234
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
235
235
t . true ( mocks . res . send . calledOnce ) ;
236
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :'HTTP content-type missing' } ) ;
236
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : 'HTTP content-type missing' } ) ;
237
237
} ) ;
238
238
239
239
test ( `stopInstance: should reject unsupported HTTP content-type` , async ( t ) => {
240
240
const mocks = getMocks ( ) ;
241
241
const sample = getSample ( ) ;
242
242
mocks . req . method = `POST` ;
243
243
mocks . req . headers [ `content-type` ] = `text/plain` ;
244
- mocks . req . body = { " zone" : " test-zone" , " instance" : " test-instance" } ;
244
+ mocks . req . body = { ' zone' : ' test-zone' , ' instance' : ' test-instance' } ;
245
245
sample . program . stopInstance ( mocks . req , mocks . res ) ;
246
246
247
247
t . true ( mocks . res . status . calledOnce ) ;
248
248
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
249
249
t . true ( mocks . res . send . calledOnce ) ;
250
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :'Unsupported HTTP content-type text/plain; use application/json or application/octet-stream' } ) ;
250
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : 'Unsupported HTTP content-type text/plain; use application/json or application/octet-stream' } ) ;
251
251
} ) ;
252
252
253
253
test ( `stopInstance: should fail with missing 'zone' attribute` , async ( t ) => {
254
254
const mocks = getMocks ( ) ;
255
255
const sample = getSample ( ) ;
256
256
mocks . req . method = `POST` ;
257
257
mocks . req . headers [ `content-type` ] = `application/json` ;
258
- mocks . req . body = { " instance" : " test-instance" } ;
258
+ mocks . req . body = { ' instance' : ' test-instance' } ;
259
259
sample . program . stopInstance ( mocks . req , mocks . res ) ;
260
260
261
261
t . true ( mocks . res . status . calledOnce ) ;
262
262
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
263
263
t . true ( mocks . res . send . calledOnce ) ;
264
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :`Attribute 'zone' missing from POST request` } ) ;
264
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : `Attribute 'zone' missing from POST request` } ) ;
265
265
} ) ;
266
266
267
267
test ( `stopInstance: should fail with missing 'instance' attribute` , async ( t ) => {
268
268
const mocks = getMocks ( ) ;
269
269
const sample = getSample ( ) ;
270
270
mocks . req . method = `POST` ;
271
271
mocks . req . headers [ `content-type` ] = `application/json` ;
272
- mocks . req . body = { " zone" : " test-zone" } ;
272
+ mocks . req . body = { ' zone' : ' test-zone' } ;
273
273
sample . program . stopInstance ( mocks . req , mocks . res ) ;
274
274
275
275
t . true ( mocks . res . status . calledOnce ) ;
276
276
t . is ( mocks . res . status . firstCall . args [ 0 ] , 400 ) ;
277
277
t . true ( mocks . res . send . calledOnce ) ;
278
- t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error :`Attribute 'instance' missing from POST request` } ) ;
278
+ t . deepEqual ( mocks . res . send . firstCall . args [ 0 ] , { error : `Attribute 'instance' missing from POST request` } ) ;
279
279
} ) ;
0 commit comments