mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-22 01:01:29 +00:00
adding in some api tests
This commit is contained in:
37
api.test.js
Normal file
37
api.test.js
Normal file
@@ -0,0 +1,37 @@
|
||||
const request = require('superagent');
|
||||
const brewData = require('./server/brew.data.js');
|
||||
|
||||
const path = 'localhost:8000';
|
||||
|
||||
request.post(`${path}/api/brew`)
|
||||
.send({
|
||||
text : 'new brew'
|
||||
})
|
||||
.end((err, res) => {
|
||||
console.log(err, res && res.body);
|
||||
|
||||
console.log('creaitng brew');
|
||||
|
||||
//creating brew
|
||||
brewData.create({
|
||||
text : 'yeah yeah'
|
||||
})
|
||||
.then((brew) => {
|
||||
console.log(brew);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
|
||||
/*
|
||||
res.body.text = 'check it';
|
||||
brewData.update(res.body)
|
||||
.then((newBrew) => {
|
||||
console.log(newBrew);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
*/
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user