forked from AndrewKeig/express-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
context.js
36 lines (34 loc) · 931 Bytes
/
context.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';
require('should');
var app = require('./app');
var request = require('supertest');
describe('for validating array values', function () {
describe('when the schema contains a reference to the request object', function () {
it('should return a 200 ok response', function (done) {
request(app)
.post('/context/1')
.send({ id: '1' })
.expect(200)
.end(function (err, res) {
if (err) {
return done(err);
}
done();
});
});
});
describe('when the schema contains an invalid reference to the request object', function () {
it('should return a 400 response', function (done) {
request(app)
.post('/context/1')
.send({ id: '2' })
.expect(400)
.end(function (err, res) {
if (err) {
return done(err);
}
done();
});
});
});
});