Last active
August 29, 2017 05:15
-
-
Save spirinvladimir/9c843ec54561033655dbf7d21aa83eed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
test.cb('PUT /api/stocks/1 (update the price of a single stock)', t => { | |
const | |
app = webserver(createList(), port()); | |
request(app) | |
.post('/api/stocks') | |
.send({name: 'EUR', currentPrice: 1}) | |
.expect(200) | |
.then(res => res.body.id) | |
.then(id => request(app) | |
.put('/api/stocks/' + id) | |
.send({currentPrice: 2}) | |
.set('Accept', 'application/json') | |
.expect(200)) | |
.then(() => id) | |
.then(id => request(app) | |
.get('/api/stocks/' + id) | |
.set('Accept', 'application/json') | |
.expect(200)) | |
.then(res => res.body.currentPrice) | |
.then((currentPrice) => { | |
app.close(); | |
t.deepEqual(currentPrice, 2); | |
t.end(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment