jsonapi-checker-lib
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "jsonapi-checker-lib", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Lib to check some input follows the JSON API specifications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -17,5 +17,3 @@ 'use strict'; | ||
'attributes.isObject', | ||
() => { | ||
expect(obj).to.be.an('object') | ||
} | ||
() => expect(obj).to.be.an('object') | ||
); | ||
@@ -31,3 +29,3 @@ | ||
}); | ||
} | ||
}; | ||
}; |
@@ -118,3 +118,3 @@ 'use strict'; | ||
}); | ||
} | ||
}; | ||
}; |
@@ -19,20 +19,2 @@ 'use strict'; | ||
Assertion.addMethod('Fields', function () { | ||
const value = this._obj; | ||
const ownFieldKeys = _.keys(value); | ||
const otherFieldKeys = _.keys(otherFields); | ||
const intersectionFieldKeys = _.intersection(ownFieldKeys, otherFieldKeys); | ||
ruleValidator.forEach( | ||
value, | ||
(v, key) => expect(key).be.FieldName() | ||
); | ||
ruleValidator( | ||
'fields.commonNamespace', | ||
() => expect(intersectionFieldKeys).to.be.empty, | ||
intersectionFieldKeys[0] | ||
); | ||
}); | ||
Assertion.addMethod('MemberName', function () { | ||
@@ -70,3 +52,3 @@ const value = this._obj; | ||
}); | ||
} | ||
}; | ||
}; |
@@ -71,3 +71,3 @@ 'use strict'; | ||
}); | ||
} | ||
}; | ||
}; |
@@ -28,2 +28,13 @@ 'use strict'; | ||
}); | ||
Assertion.addMethod('ValidHeaders', function() { | ||
const ruleValidator = require('./rules/validator')(_); | ||
const givenHeaders = this._obj; | ||
const expectedContentType = 'application/vnd.api+json'; | ||
ruleValidator( | ||
'serverHeaders.contentType', | ||
() => expect(givenHeaders.contentType).to.be.equals(expectedContentType) | ||
); | ||
}); | ||
} | ||
@@ -30,0 +41,0 @@ ); |
@@ -78,3 +78,3 @@ 'use strict'; | ||
}); | ||
} | ||
}; | ||
}; |
@@ -143,3 +143,3 @@ 'use strict'; | ||
}); | ||
} | ||
}; | ||
}; |
@@ -115,3 +115,3 @@ 'use strict'; | ||
}); | ||
} | ||
}; | ||
}; |
@@ -14,3 +14,3 @@ 'use strict'; | ||
throw new Error('An error should be thrown'); | ||
} catch(error) { | ||
} catch (error) { | ||
validator(error); | ||
@@ -37,3 +37,3 @@ } | ||
}); | ||
} | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165529
69
3806
63