File tree Expand file tree Collapse file tree 5 files changed +31
-6
lines changed Expand file tree Collapse file tree 5 files changed +31
-6
lines changed Original file line number Diff line number Diff line change 1
1
# snipe
2
2
3
- [ ![ Build Status] ( https://travis-ci.org/EnsembleLab/snipe.svg?branch=master )] ( https://travis-ci.org/EnsembleLab/snipe )
3
+ [ ![ Build Status] ( https://travis-ci.org/EnsembleLab/snipe.svg?branch=master )] ( https://travis-ci.org/EnsembleLab/snipe ) [ ![ codecov] ( https://codecov.io/gh/EnsembleLab/snipe/branch/master/graph/badge.svg )] ( https://codecov.io/gh/EnsembleLab/snipe )
4
+
4
5
5
6
6
7
Freelance Platform
Original file line number Diff line number Diff line change 39
39
"crypto" : " 0.0.3" ,
40
40
"debug" : " ^2.6.3" ,
41
41
"express" : " ^4.15.2" ,
42
+ "express-validator" : " ^3.1.2" ,
42
43
"lodash" : " ^4.17.4" ,
43
44
"mongoose" : " ^4.9.0" ,
44
45
"q" : " ^1.4.1" ,
Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
var util = require ( 'util' ) ;
3
3
var debug = require ( 'debug' ) ( 'validator' ) ;
4
+ var _ = require ( 'lodash' ) ;
4
5
5
6
module . exports = function ( req , res , next ) {
6
7
debug ( 'starting validation check.' ) ;
7
8
debug ( 'What we got: ' , req . body ) ;
8
9
var parameters = req . _required ;
10
+ var ignores = req . _ignored ;
9
11
if ( parameters . length ) {
10
12
var last = parameters . length - 1 ;
11
13
for ( var n in parameters ) {
12
14
if ( parameters [ n ] ) {
13
15
debug ( 'validating ' + parameters [ n ] ) ;
14
16
req . check ( parameters [ n ] , parameters [ n ] + ' is required' ) . notEmpty ( ) ;
15
- if ( parameters [ n ] === 'otptransactionidentifier' || parameters [ n ] === 'trxreference' || parameters [ n ] === 'trxauthorizeid' ) { /* jshint ignore:line */
17
+ if ( _ . indexOf ( parameters [ n ] ) > - 1 ) { /* jshint ignore:line */
16
18
// Skip
17
19
} else {
18
20
req . sanitize ( parameters [ n ] ) . escape ( ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ var chai = require ( 'chai' ) ;
3
+ chai . should ( ) ;
4
+
5
+ var config = require ( '../config' ) ;
6
+
7
+ describe ( '#Config test' , function ( ) {
8
+ it ( 'should be an object' , function ( done ) {
9
+ config . should . be . an ( 'object' ) ;
10
+ done ( ) ;
11
+ } ) ;
12
+ } ) ;
Original file line number Diff line number Diff line change @@ -160,12 +160,21 @@ describe('#Encryption service test', function(){
160
160
req . body . secureData = req . header ( 'encryptedData' ) ;
161
161
req . body . truth = demoDataHash ;
162
162
encryption . interpreter ( req , res , next ) ;
163
- setTimeout ( 100 , function ( ) {
163
+ setTimeout ( 1000 , function ( ) {
164
164
nextChecker . should . be . true ; /* jslint ignore:line */
165
+ nextChecker = false ;
165
166
} ) ;
166
167
done ( ) ;
167
168
} ) ;
168
-
169
-
170
-
169
+ } ) ;
170
+
171
+ // Testing validation service
172
+
173
+ var validator = require ( '../services/validator' ) ;
174
+
175
+ describe ( '#Validation service test' , function ( ) {
176
+ it ( 'should exist as a function' , function ( done ) {
177
+ validator . should . exist ; /* jslint ignore:line */
178
+ done ( ) ;
179
+ } ) ;
171
180
} ) ;
You can’t perform that action at this time.
0 commit comments