ac-sanitizer 3.9.17 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ <a name="3.10.1"></a>
2
+
3
+ ## [3.10.1](https://github.com/mmpro/ac-sanitizer/compare/v3.10.0..v3.10.1) (2022-04-24 19:38:16)
4
+
5
+
6
+ ### Bug Fix
7
+
8
+ * **App:** Fix for checking float | MP | [bd68b7c8bd76d15d22d9d2dea8ce78e07be7d3c9](https://github.com/mmpro/ac-sanitizer/commit/bd68b7c8bd76d15d22d9d2dea8ce78e07be7d3c9)
9
+ Check if type float is really a float
10
+ Related issues: [/issues#undefined](https://github.com//issues/undefined)
11
+ ### Tests
12
+
13
+ * **App:** Fixed tests | MP | [96e8d6067c219a241840e253ac9e11c36b258df0](https://github.com/mmpro/ac-sanitizer/commit/96e8d6067c219a241840e253ac9e11c36b258df0)
14
+ Make sure to check for errors from function
15
+ Related issues: [/issues#undefined](https://github.com//issues/undefined)
16
+ <a name="3.10.0"></a>
17
+
18
+ # [3.10.0](https://github.com/mmpro/ac-sanitizer/compare/v3.9.18..v3.10.0) (2022-04-24 18:45:04)
19
+
20
+
21
+ ### Feature
22
+
23
+ * **App:** Add type any | MP | [ff0858e978b7f7195f68ad5c9c346723107075fb](https://github.com/mmpro/ac-sanitizer/commit/ff0858e978b7f7195f68ad5c9c346723107075fb)
24
+ Type any will try to determine the actual type but gives you flexibility while sanitizing.
25
+ Related issues: [/issues#undefined](https://github.com//issues/undefined)
26
+ <a name="3.9.18"></a>
27
+
28
+ ## [3.9.18](https://github.com/mmpro/ac-sanitizer/compare/v3.9.17..v3.9.18) (2022-04-24 18:09:53)
29
+
30
+
31
+ ### Bug Fix
32
+
33
+ * **App:** Minor fix for special fields | MP | [dc5a393127a74ebe948c8c5c953969688463422b](https://github.com/mmpro/ac-sanitizer/commit/dc5a393127a74ebe948c8c5c953969688463422b)
34
+ Only check if they are in payload.
35
+ Related issues: [/issues#undefined](https://github.com//issues/undefined)
1
36
  <a name="3.9.17"></a>
2
37
 
3
38
  ## [3.9.17](https://github.com/mmpro/ac-sanitizer/compare/v3.9.16..v3.9.17) (2022-04-24 14:58:01)
package/README.md CHANGED
@@ -69,6 +69,7 @@ countrylist | list of country names | e.g. Laos, Brazil, Norway...
69
69
 
70
70
  Type | Options | Remarks
71
71
  --- | --- | --- |
72
+ any | | Any can be string, integer, boolean, object or array - it will be automatically detected.
72
73
  base64 | | Checks if a string is base64 encoded, optional with field option "convert" (to string)
73
74
  boolean | |
74
75
  cidr | | Check CIDR, see example
package/index.js CHANGED
@@ -114,8 +114,30 @@ const sanitizer = function() {
114
114
  }
115
115
  }
116
116
 
117
- if (!error) {
117
+ if (!error && _.has(paramsToCheck, fieldName)) {
118
118
  /// SPECIAL FIELDS
119
+ // field type any, can be any field
120
+ if (field.type === 'any') {
121
+ if (_.isString(value)) {
122
+ field.type = 'string'
123
+ }
124
+ else if (_.isPlainObject(value)) {
125
+ field.type = 'object'
126
+ }
127
+ else if (_.isArray(value)) {
128
+ field.type = 'array'
129
+ }
130
+ else if (_.isBoolean(value)) {
131
+ field.type = 'boolean'
132
+ }
133
+ else if (_.isFinite(parseInt(value))) {
134
+ field.type = 'integer'
135
+ }
136
+ else {
137
+ error = { message: fieldName + '_any_couldNotResolveType' }
138
+ }
139
+ }
140
+
119
141
  // special field - can be string or integer -> determine type and then use type settings
120
142
  if (field.type === 'integer | string') {
121
143
  if (!_.isString(value) && !_.isFinite(parseInt(value))) {
@@ -170,27 +192,36 @@ const sanitizer = function() {
170
192
  }
171
193
  else if (_.indexOf(['number', 'integer', 'long', 'short', 'float'], field.type) > -1) {
172
194
  if (typeof value != 'number' || isNaN(value)) error = { message: fieldName + '_' + getTypeMapping('integer', 'errorMessage') }
195
+ else {
196
+ // Number types - usually we allow only non-negative values (unsigned). If you want negative values, set type.subtype 'signed'
197
+ if (field.type === 'number') console.error('SANITIZER - number should not be used, be more precise')
198
+ if (field.type === 'number') field.type = 'integer'
173
199
 
174
- // Number types - usually we allow only non-negative values (unsigned). If you want negative values, set type.subtype 'signed'
175
- if (field.type === 'number') console.error('SANITIZER - number should not be used, be more precise')
176
- if (field.type === 'number') field.type = 'integer'
177
-
178
- const subtype = _.get(field, 'subtype')
179
- let ranges = {
180
- integer: [(subtype === 'signed' ? -Math.pow(2, 31) : 0), Math.pow(2, 31)],
181
- long: [(subtype === 'signed' ? -(Math.pow(2,53) - 1) : 0), Math.pow(2, 53)-1],
182
- short: [(subtype === 'signed' ? -Math.pow(2, 15) : 0), Math.pow(2, 15)],
183
- float: [(subtype === 'signed' ? -Math.pow(2, 31) : 0), Math.pow(2, 31)]
184
- }
185
- let range = _.get(field, 'range', _.get(ranges, field.type, ranges.integer))
200
+ if (field.type === 'float' && value !== parseFloat(value)) {
201
+ error = { message: fieldName + '_not_' + field.type, additionalInfo: { value } }
202
+ }
203
+ else if (field.type !== 'float' && value !== parseInt(value)) {
204
+ error = { message: fieldName + '_typeIncorrect', additionalInfo: { value, int: parseInt(value) } }
205
+ }
206
+ else {
207
+ const subtype = _.get(field, 'subtype')
208
+ let ranges = {
209
+ integer: [(subtype === 'signed' ? -Math.pow(2, 31) : 0), Math.pow(2, 31)],
210
+ long: [(subtype === 'signed' ? -(Math.pow(2,53) - 1) : 0), Math.pow(2, 53)-1],
211
+ short: [(subtype === 'signed' ? -Math.pow(2, 15) : 0), Math.pow(2, 15)],
212
+ float: [(subtype === 'signed' ? -Math.pow(2, 31) : 0), Math.pow(2, 31)]
213
+ }
214
+ let range = _.get(field, 'range', _.get(ranges, field.type, ranges.integer))
186
215
 
187
- if (field.type === 'float') value = parseFloat(value)
188
- else value = parseInt(value)
216
+ if (field.type === 'float') value = parseFloat(value)
217
+ else value = parseInt(value)
189
218
 
190
- let lowest = _.first(range)
191
- let highest = _.size(range) === 2 && _.last(range)
192
- if (value < lowest || (highest && value > highest)) {
193
- error = { message: fieldName + '_outOfRange', additionalInfo: { range, value } }
219
+ let lowest = _.first(range)
220
+ let highest = _.size(range) === 2 && _.last(range)
221
+ if (value < lowest || (highest && value > highest)) {
222
+ error = { message: fieldName + '_outOfRange', additionalInfo: { range, value } }
223
+ }
224
+ }
194
225
  }
195
226
  }
196
227
  else if (field.type === 'string') {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Mark Poepping (https://www.admiralcloud.com)",
5
5
  "license": "MIT",
6
6
  "repository": "admiralcloud/ac-sanitizer",
7
- "version": "3.9.17",
7
+ "version": "3.10.1",
8
8
  "homepage": "https://www.admiralcloud.com",
9
9
  "dependencies": {
10
10
  "ac-countrylist": "^1.0.6",
@@ -12,6 +12,11 @@ module.exports = {
12
12
  tests.error.test()
13
13
  })
14
14
 
15
+ describe('ANY', function() {
16
+ this.timeout(timeOut)
17
+ tests.any.test()
18
+ })
19
+
15
20
  describe('STRING', function() {
16
21
  this.timeout(timeOut)
17
22
  tests.string.test()
@@ -0,0 +1,48 @@
1
+ const _ = require('lodash')
2
+ const expect = require('expect')
3
+ const sanitizer = require('../../index')
4
+
5
+ module.exports = {
6
+
7
+ test: () => {
8
+
9
+ const baseTests = [
10
+ { name: 'Any - with string', type: 'any', value: 'admiralcloud', expected: 'admiralcloud' },
11
+ { name: 'Any - with integer', type: 'any', value: 123, expected: 123 },
12
+ { name: 'Any - with boolean', type: 'any', value: true, expected: true },
13
+ { name: 'Any - with boolean - false', type: 'any', value: false, expected: false },
14
+ { name: 'Any - with object', type: 'any', value: { a: 123 }, expected: { a: 123 } },
15
+ { name: 'Any - with array', type: 'any', value: [1,2,3], expected: [1,2,3] },
16
+ { name: 'Any - with array of objects', type: 'any', value: [{ a: 123 }], expected: [{ a: 123 }] },
17
+ { name: 'Any - with float - cannot auto-detect', type: 'any', value: 123.235, error: 'any_typeIncorrect', additionalInfo: { value: 123.235, int: 123 } },
18
+ ]
19
+
20
+ _.forEach(baseTests, (test) => {
21
+ it(test.name, (done) => {
22
+ let fieldsToCheck = {
23
+ params: {
24
+ any: _.get(test, 'value')
25
+ },
26
+ fields: [
27
+ { field: 'any', type: _.get(test, 'type') }
28
+ ]
29
+ }
30
+ let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
31
+ if (_.get(r, 'error')) {
32
+ expect(_.get(r, 'error.message')).toEqual(test.error)
33
+ if (_.get(test, 'additionalInfo')) {
34
+ expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
35
+ }
36
+ }
37
+ else {
38
+ expect(_.get(r, 'params.any')).toEqual(_.get(test, 'expected'))
39
+ }
40
+ return done()
41
+ })
42
+
43
+ })
44
+
45
+
46
+
47
+ }
48
+ }
@@ -50,7 +50,7 @@ module.exports = {
50
50
  }
51
51
 
52
52
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
53
- if (_.get(test, 'error')) {
53
+ if (_.get(r, 'error')) {
54
54
  expect(_.get(r, 'error.message')).toEqual(test.error)
55
55
  if (_.get(test, 'additionalInfo')) {
56
56
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -28,7 +28,7 @@ module.exports = {
28
28
  }
29
29
 
30
30
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
31
- if (_.get(test, 'error')) {
31
+ if (_.get(r, 'error')) {
32
32
  expect(_.get(r, 'error.message')).toEqual(test.error)
33
33
  if (_.get(test, 'additionalInfo')) {
34
34
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -28,7 +28,7 @@ module.exports = {
28
28
  }
29
29
 
30
30
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
31
- if (_.get(test, 'error')) {
31
+ if (_.get(r, 'error')) {
32
32
  expect(_.get(r, 'error.message')).toEqual(test.error)
33
33
  if (_.get(test, 'additionalInfo')) {
34
34
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -24,7 +24,7 @@ module.exports = {
24
24
  }
25
25
 
26
26
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
27
- if (_.get(test, 'error')) {
27
+ if (_.get(r, 'error')) {
28
28
  expect(_.get(r, 'error.message')).toEqual(test.error)
29
29
  if (_.get(test, 'additionalInfo')) {
30
30
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -29,7 +29,7 @@ module.exports = {
29
29
  }
30
30
 
31
31
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
32
- if (_.get(test, 'error')) {
32
+ if (_.get(r, 'error')) {
33
33
  expect(_.get(r, 'error.message')).toEqual(test.error)
34
34
  if (_.get(test, 'additionalInfo')) {
35
35
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -25,7 +25,7 @@ module.exports = {
25
25
  }
26
26
 
27
27
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
28
- if (_.get(test, 'error')) {
28
+ if (_.get(r, 'error')) {
29
29
  expect(_.get(r, 'error.message')).toEqual(test.error)
30
30
  if (_.get(test, 'additionalInfo')) {
31
31
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -31,7 +31,7 @@ module.exports = {
31
31
  }
32
32
 
33
33
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
34
- if (_.get(test, 'error')) {
34
+ if (_.get(r, 'error')) {
35
35
  expect(_.get(r, 'error.message')).toEqual(test.error)
36
36
  if (_.get(test, 'additionalInfo')) {
37
37
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -26,7 +26,7 @@ module.exports = {
26
26
  }
27
27
 
28
28
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
29
- if (_.get(test, 'error')) {
29
+ if (_.get(r, 'error')) {
30
30
  expect(_.get(r, 'error.message')).toEqual(test.error)
31
31
  if (_.get(test, 'additionalInfo')) {
32
32
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -17,16 +17,17 @@ module.exports = {
17
17
  it(test.name, (done) => {
18
18
  let fieldsToCheck = {
19
19
  adminLevel: 4,
20
+ omitFields: _.get(test, 'omitFields'),
20
21
  params: {
21
22
  errorField: _.get(test, 'value'),
22
23
  },
23
24
  fields: [
24
- { field: 'errorField', type: _.get(test, 'type'), required: _.get(test, 'required'), adminLevel: _.get(test, 'adminLevel'), omitFields: _.get(test, 'omitFields') }
25
+ { field: 'errorField', type: _.get(test, 'type'), required: _.get(test, 'required'), adminLevel: _.get(test, 'adminLevel') }
25
26
  ]
26
27
  }
27
28
 
28
29
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
29
- if (_.get(test, 'error')) {
30
+ if (_.get(r, 'error')) {
30
31
  expect(_.get(r, 'error.message')).toEqual(test.error)
31
32
  if (_.get(test, 'additionalInfo')) {
32
33
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -25,7 +25,7 @@ module.exports = {
25
25
  }
26
26
 
27
27
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
28
- if (_.get(test, 'error')) {
28
+ if (_.get(r, 'error')) {
29
29
  expect(_.get(r, 'error.message')).toEqual(test.error)
30
30
  if (_.get(test, 'additionalInfo')) {
31
31
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -23,7 +23,7 @@ module.exports = {
23
23
  ]
24
24
  }
25
25
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
26
- if (_.get(test, 'error')) {
26
+ if (_.get(r, 'error')) {
27
27
  expect(_.get(r, 'error.message')).toEqual(test.error)
28
28
  if (_.get(test, 'additionalInfo')) {
29
29
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
package/test/tests/gps.js CHANGED
@@ -28,7 +28,7 @@ module.exports = {
28
28
  }
29
29
 
30
30
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
31
- if (_.get(test, 'error')) {
31
+ if (_.get(r, 'error')) {
32
32
  expect(_.get(r, 'error.message')).toEqual(test.error)
33
33
  if (_.get(test, 'additionalInfo')) {
34
34
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -28,7 +28,7 @@ module.exports = {
28
28
  }
29
29
 
30
30
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
31
- if (_.get(test, 'error')) {
31
+ if (_.get(r, 'error')) {
32
32
  expect(_.get(r, 'error.message')).toEqual(test.error)
33
33
  if (_.get(test, 'additionalInfo')) {
34
34
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -25,7 +25,7 @@ module.exports = {
25
25
  }
26
26
 
27
27
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
28
- if (_.get(test, 'error')) {
28
+ if (_.get(r, 'error')) {
29
29
  expect(_.get(r, 'error.message')).toEqual(test.error)
30
30
  if (_.get(test, 'additionalInfo')) {
31
31
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ any: require('./any'),
2
3
  array: require('./array'),
3
4
  base64: require('./base64'),
4
5
  bool: require('./bool'),
package/test/tests/ip.js CHANGED
@@ -26,7 +26,7 @@ module.exports = {
26
26
  }
27
27
 
28
28
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
29
- if (_.get(test, 'error')) {
29
+ if (_.get(r, 'error')) {
30
30
  expect(_.get(r, 'error.message')).toEqual(test.error)
31
31
  if (_.get(test, 'additionalInfo')) {
32
32
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -101,6 +101,7 @@ module.exports = {
101
101
  { name: 'Unsigned float -1 - should fail and display additionalInfo', type: 'float', value: -1, error: 'number_outOfRange', additionalInfo: { range: [0,2147483648], value: -1 } },
102
102
  { name: 'Array of numbers with one entry', type: 'integer', value: [123], error: 'number_notAFiniteNumber' },
103
103
  { name: 'Array of numbers with multiple entries', type: 'integer', value: [123, 456], error: 'number_notAFiniteNumber' },
104
+ { name: 'Check float', type: 'float', range: [-90, 90], value: 53.15, expected: 53.15 }
104
105
  ]
105
106
 
106
107
  _.forEach(tests, (test) => {
@@ -115,7 +116,7 @@ module.exports = {
115
116
  }
116
117
 
117
118
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
118
- if (_.get(test, 'error')) {
119
+ if (_.get(r, 'error')) {
119
120
  expect(_.get(r, 'error.message')).toEqual(test.error)
120
121
  if (_.get(test, 'additionalInfo')) {
121
122
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -181,7 +181,7 @@ module.exports = {
181
181
  ],
182
182
  };
183
183
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck);
184
- if (_.get(test, 'error')) {
184
+ if (_.get(r, 'error')) {
185
185
  expect(_.get(r, 'error.message')).toEqual(test.error)
186
186
  if (_.get(test, 'additionalInfo')) {
187
187
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -26,7 +26,7 @@ module.exports = {
26
26
  }
27
27
 
28
28
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
29
- if (_.get(test, 'error')) {
29
+ if (_.get(r, 'error')) {
30
30
  expect(_.get(r, 'error.message')).toEqual(test.error)
31
31
  if (_.get(test, 'additionalInfo')) {
32
32
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
package/test/tests/rgb.js CHANGED
@@ -28,7 +28,7 @@ module.exports = {
28
28
  }
29
29
 
30
30
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
31
- if (_.get(test, 'error')) {
31
+ if (_.get(r, 'error')) {
32
32
  expect(_.get(r, 'error.message')).toEqual(test.error)
33
33
  if (_.get(test, 'additionalInfo')) {
34
34
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -32,7 +32,7 @@ module.exports = {
32
32
  }
33
33
 
34
34
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
35
- if (_.get(test, 'error')) {
35
+ if (_.get(r, 'error')) {
36
36
  expect(_.get(r, 'error.message')).toEqual(test.error)
37
37
  if (_.get(test, 'additionalInfo')) {
38
38
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -11,6 +11,7 @@ module.exports = {
11
11
  { name: 'Valid empty string', type: 'integer | string', value: '', expected: '', minLength: 0 },
12
12
  { name: 'Valid integer', type: 'integer | string', value: 123, expected: 123 },
13
13
  { name: 'Invalid - neither string nor integer', type: 'integer | string', value: ['abc'], error: 'stringOrInteger_neitherStringNorInteger' },
14
+ { name: 'Valid - no data - ignore', type: 'integer | string' },
14
15
  ]
15
16
 
16
17
 
@@ -19,13 +20,13 @@ module.exports = {
19
20
  let fieldsToCheck = {
20
21
  params: {},
21
22
  fields: [
22
- { field: 'stringOrInteger', type: _.get(test, 'type'), required: _.get(test, 'required') }
23
+ { field: 'stringOrInteger', type: _.get(test, 'type'), required: _.get(test, 'required'), minLength: _.get(test, 'minLength') }
23
24
  ]
24
25
  }
25
26
  if (_.has(test, 'value')) fieldsToCheck.params.stringOrInteger = test.value
26
27
 
27
28
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
28
- if (_.get(test, 'error')) {
29
+ if (_.get(r, 'error')) {
29
30
  expect(_.get(r, 'error.message')).toEqual(test.error)
30
31
  if (_.get(test, 'additionalInfo')) {
31
32
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
package/test/tests/url.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  }
25
25
 
26
26
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
27
- if (_.get(test, 'error')) {
27
+ if (_.get(r, 'error')) {
28
28
  expect(_.get(r, 'error.message')).toEqual(test.error)
29
29
  if (_.get(test, 'additionalInfo')) {
30
30
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))
@@ -25,7 +25,7 @@ module.exports = {
25
25
  }
26
26
 
27
27
  let r = sanitizer.checkAndSanitizeValues(fieldsToCheck)
28
- if (_.get(test, 'error')) {
28
+ if (_.get(r, 'error')) {
29
29
  expect(_.get(r, 'error.message')).toEqual(test.error)
30
30
  if (_.get(test, 'additionalInfo')) {
31
31
  expect(_.get(r, 'error.additionalInfo')).toEqual(_.get(test, 'additionalInfo'))