aboutsummaryrefslogtreecommitdiff
path: root/node_modules/express-validator/test/sanitizeParamsTest.js
diff options
context:
space:
mode:
authorKumar Damani <kumar.damani@mail.utoronto.ca>2019-04-16 13:17:06 +0000
committerKumar Damani <kumar.damani@mail.utoronto.ca>2019-04-16 13:17:06 +0000
commitdc46b87abee1e441c07524ddde67fd902a919336 (patch)
tree13eba08b8655dfd78e9600ec5f612011a0bf3b35 /node_modules/express-validator/test/sanitizeParamsTest.js
parent26f4b38e9e5a202756a7c33abc775aea2617aeaf (diff)
added some dependencies to package.json
Diffstat (limited to 'node_modules/express-validator/test/sanitizeParamsTest.js')
-rw-r--r--node_modules/express-validator/test/sanitizeParamsTest.js65
1 files changed, 0 insertions, 65 deletions
diff --git a/node_modules/express-validator/test/sanitizeParamsTest.js b/node_modules/express-validator/test/sanitizeParamsTest.js
deleted file mode 100644
index 8d331f1..0000000
--- a/node_modules/express-validator/test/sanitizeParamsTest.js
+++ /dev/null
@@ -1,65 +0,0 @@
-var chai = require('chai');
-var expect = chai.expect;
-var request = require('supertest');
-
-var app;
-function validation(req, res) {
- req.sanitizeParams('testparam').whitelist(['a', 'b', 'c']);
- res.send({ params: req.params });
-}
-
-function pass(body) {
- expect(body).to.have.deep.property('params.testparam', 'abc');
-}
-function fail(body) {
- expect(body).to.not.have.property('params', 'testparam');
-}
-
-function getRoute(path, test, done) {
- request(app)
- .get(path)
- .end(function(err, res) {
- test(res.body);
- done();
- });
-}
-
-function postRoute(path, data, test, done) {
- request(app)
- .post(path)
- .send(data)
- .end(function(err, res) {
- test(res.body);
- done();
- });
-}
-
-// This before() is required in each set of tests in
-// order to use a new validation function in each file
-before(function() {
- delete require.cache[require.resolve('./helpers/app')];
- app = require('./helpers/app')(validation);
-});
-
-describe('#sanitizeParams', function() {
- describe('GET tests', function() {
- it('should return property and sanitized value when param is present', function(done) {
- getRoute('/abcdef', pass, done);
- });
- it('should not return property when param is missing', function(done) {
- getRoute('/', fail, done);
- });
-
-
- });
- describe('POST tests', function() {
- it('should return property and sanitized value when param is present', function(done) {
- postRoute('/abcdef', null, pass, done);
- });
-
- it('should not return property when param is missing', function(done) {
- postRoute('/', null, fail, done);
- });
-
- });
-});