Last active
August 21, 2018 17:14
-
-
Save freele/74aa89e6e02351c269e8400a24f8a1d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lab.test( | |
'/Allows to upload results if user is authorized, no image processing on server-side (and new step2 processing)', | |
(done) => { | |
const form = new FormData(); | |
form.append('setId', `${adminUser.username}/${filename}`); | |
form.append('incentivesOrder', 'photo1;photo2;photo3'); | |
form.append('file', fs.createReadStream(fileDest)); | |
streamToPromise(form) | |
.then(formPromise => _server.inject({ | |
method: 'POST', | |
url: '/api/frames/sync-v2', | |
headers: { | |
'content-type': 'multipart/form-data', | |
authorization: `JWT ${_jwt}`, | |
...form.getHeaders(), | |
}, | |
payload: formPromise, | |
})) | |
.then((res) => { | |
const { data } = res.result; | |
assert.equal(res.statusCode, 200); | |
assert.ok(data.id); | |
console.log('DEBUG', JSON.stringify(data.result, null, 4)); | |
_resultId = data.id; | |
// _resultsLength = data.result.split(' ').length; | |
assert.ok(data.setId); | |
assert.ok(data.result); | |
assert.ok(data.created); | |
assert.ok(data.incentivesOrder); | |
return done(); | |
}) | |
.catch(done); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment