add 400 conditions

This commit is contained in:
Michael C
2021-07-10 16:30:30 -04:00
parent 596dbf4ac8
commit e8d0da3ce3
7 changed files with 47 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import fetch from 'node-fetch';
import {Done, getbaseURL} from '../utils';
import {db} from '../../src/databases/databases';
import {getHash} from '../../src/utils/getHash';
import assert from 'assert';
describe('postWarning', () => {
before(async () => {
@@ -127,4 +128,19 @@ describe('postWarning', () => {
})
.catch(err => done(err));
});
it('Should return 400 if missing body', (done: Done) => {
fetch(getbaseURL()
+ "/api/warnUser", {
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
})
.then(async res => {
assert.strictEqual(res.status, 400);
done();
})
.catch(err => done(err));
});
});