Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@venncity/errors

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@venncity/errors - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [1.1.2](https://github.com/venn-city/npm-shelf/compare/@venncity/errors@1.1.1...@venncity/errors@1.1.2) (2019-04-15)
### Bug Fixes
* **errors:** use Joi.validate instead of Joi.assert in validator ([bf7adb8](https://github.com/venn-city/npm-shelf/commit/bf7adb8))
## [1.1.1](https://github.com/venn-city/npm-shelf/compare/@venncity/errors@1.1.0...@venncity/errors@1.1.1) (2019-04-14)

@@ -8,0 +19,0 @@

4

package.json
{
"name": "@venncity/errors",
"version": "1.1.1",
"version": "1.1.2",
"author": "Venn Engineering",

@@ -30,3 +30,3 @@ "main": "src/index.js",

},
"gitHead": "ed3a3d704da91d6c7ed014c9afe82cde78da3b5d"
"gitHead": "aea4681ff492d2893dee491276d8202f72ba2446"
}

@@ -6,7 +6,16 @@ const { ClientDataValidationError, UnknownError } = require('./../errors/errors');

test('assert with default options', () => {
expect(() => assert({ a: 'a' }, v.object().keys({ a: v.number() }))).toThrowError(/VennServerDataValidationError.*/);
expect(() => assert({ a: 'a' }, { a: v.number() })).toThrowError(/VennServerDataValidationError.*/);
});
test('check our custom joi defaults', () => {
expect(() => assert({ a: 'a', b: 'b' }, { a: v.string() })).not.toThrow();
expect(() => assert({ a: 'a', b: 'b' }, { a: v.string(), c: v.number(), d: v.string() })).toThrow();
});
test('check our custom joi defaults override', () => {
expect(() => assert({ a: 'a', b: 'b' }, { a: v.string() }, { joiOptions: { allowUnknown: false } })).toThrow();
});
test('assert with custom message and error', () => {
expect(() => assert({ a: 'a' }, v.object().keys({ a: v.number() }), { message: 'msg', ValidationError: ClientDataValidationError }))
expect(() => assert({ a: 'a' }, { a: v.number() }, { message: 'msg', ValidationError: ClientDataValidationError }))
.toThrowError(ClientDataValidationError);

@@ -16,3 +25,3 @@ });

test('assert with custom message, error and override clientVisible', () => {
expect(() => assert({ a: 'a' }, v.object().keys({ a: v.number() }),
expect(() => assert({ a: 'a' }, { a: v.number() },
{

@@ -19,0 +28,0 @@ message: 'msg',

@@ -15,3 +15,7 @@ const Joi = require('joi');

try {
Joi.assert(value, schema, { abortEarly, allowUnknown, presence });
Joi.validate(value, schema, { abortEarly, allowUnknown, presence }, (err) => {
if (err) {
throw err;
}
});
} catch (e) {

@@ -18,0 +22,0 @@ if (e.isJoi) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc