Creating a new keyword results in a POST request to /api/keywords. Let's extend our spec accordingly:
For the sake of brevity, I'm only showing the additional it block instead of the whole spec file.
it('should create a new keyword when receiving a POST request at \
/api/keywords/', function (done) {
var expected = {
"_items": [
{'id': 1, 'value': 'Aubergine', 'categoryID': 1},
{'id': 2, 'value': 'Onion', 'categoryID': 1}
]
};
var body = {
'value': 'Onion',
'categoryID': 1
};
async.series(
[
function(callback) {
dbSession.insert(
'category',
{'name': 'Vegetable'},
function(err) ...