aboutsummaryrefslogtreecommitdiff
path: root/node_modules/express-validator/test/helpers
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/helpers
parent26f4b38e9e5a202756a7c33abc775aea2617aeaf (diff)
added some dependencies to package.json
Diffstat (limited to 'node_modules/express-validator/test/helpers')
-rw-r--r--node_modules/express-validator/test/helpers/app.js45
-rw-r--r--node_modules/express-validator/test/helpers/example.js29
2 files changed, 0 insertions, 74 deletions
diff --git a/node_modules/express-validator/test/helpers/app.js b/node_modules/express-validator/test/helpers/app.js
deleted file mode 100644
index d86a4bb..0000000
--- a/node_modules/express-validator/test/helpers/app.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Sample app
-var express = require('express');
-var expressValidator = require('../../index');
-var bodyParser = require('body-parser');
-
-var port = process.env.PORT || 8888;
-var app = express();
-
-// If no native implementation of Promise exists (less than Node v4),
-// use Bluebird promises so we can test for both depending on the Node version
-if (typeof Promise === 'undefined') {
- Promise = require('bluebird');
-}
-
-module.exports = function(validation) {
-
- app.set('port', port);
- app.use(bodyParser.json());
- app.use(expressValidator({
- customValidators: {
- isArray: function(value) {
- return Array.isArray(value);
- },
- isAsyncTest: function(testparam) {
- return new Promise(function(resolve, reject) {
- setTimeout(function() {
- if (testparam === '42') { return resolve(); }
- reject();
- }, 200);
- });
- }
- },
- customSanitizers: {
- toTestSanitize: function() {
- return "!!!!";
- }
- }
- }));
-
- app.get(/\/test(\d+)/, validation);
- app.get('/:testparam?', validation);
- app.post('/:testparam?', validation);
-
- return app;
-};
diff --git a/node_modules/express-validator/test/helpers/example.js b/node_modules/express-validator/test/helpers/example.js
deleted file mode 100644
index b50f8bf..0000000
--- a/node_modules/express-validator/test/helpers/example.js
+++ /dev/null
@@ -1,29 +0,0 @@
-var util = require('util'),
- express = require('express'),
- expressValidator = require('../../index'),
- app = express.createServer();
-
-app.use(express.bodyParser());
-app.use(expressValidator);
-
-app.post('/:urlparam', function(req, res) {
-
- req.assert('postparam', 'Invalid postparam').notEmpty().isInt();
- req.assert('getparam', 'Invalid getparam').isInt();
- req.assert('urlparam', 'Invalid urlparam').isAlpha();
-
- req.sanitize('postparam').toBoolean();
-
- var errors = req.validationErrors();
- if (errors) {
- res.send('There have been validation errors: ' + util.inspect(errors), 500);
- return;
- }
- res.json({
- urlparam: req.param('urlparam'),
- getparam: req.param('getparam'),
- postparam: req.param('postparam')
- });
-});
-
-app.listen(8888);