Return 204 instead of 200 when [un]learning words

Also remove unnecessary calls to `next()`
This commit is contained in:
Simon Detheridge 2019-07-22 12:15:07 +01:00
parent 7105ee58d3
commit 00d09fd6f5
2 changed files with 6 additions and 8 deletions

View file

@ -44,8 +44,7 @@ module.exports = {
if (error != null) { if (error != null) {
return next(error) return next(error)
} }
res.sendStatus(200) res.sendStatus(204)
next()
}) })
}, },
@ -57,8 +56,7 @@ module.exports = {
if (error != null) { if (error != null) {
return next(error) return next(error)
} }
res.sendStatus(200) res.sendStatus(204)
next()
}) })
}, },

View file

@ -33,9 +33,9 @@ const deleteDict = () =>
}) })
describe('learning words', () => { describe('learning words', () => {
it('should return status 200 when posting a word successfully', async () => { it('should return status 204 when posting a word successfully', async () => {
const response = await learnWord('abcd') const response = await learnWord('abcd')
expect(response.statusCode).to.equal(200) expect(response.statusCode).to.equal(204)
}) })
it('should return no misspellings after a word is learnt', async () => { it('should return no misspellings after a word is learnt', async () => {
@ -61,9 +61,9 @@ describe('learning words', () => {
}) })
describe('unlearning words', () => { describe('unlearning words', () => {
it('should return status 200 when posting a word successfully', async () => { it('should return status 204 when posting a word successfully', async () => {
const response = await unlearnWord('anything') const response = await unlearnWord('anything')
expect(response.statusCode).to.equal(200) expect(response.statusCode).to.equal(204)
}) })
it('should return misspellings after a word is unlearnt', async () => { it('should return misspellings after a word is unlearnt', async () => {