From 51fbd012423a337e2fdc7740d8434cbee0401695 Mon Sep 17 00:00:00 2001 From: Moses3301 Date: Sun, 29 Nov 2020 23:59:34 +0200 Subject: [PATCH] run lint #521 --- .../enforce/compounds/__tests__/allOf.test.js | 50 +++++++++---------- .../enforce/compounds/__tests__/anyOf.test.js | 2 - .../n4s/src/enforce/compounds/compounds.js | 4 +- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/packages/n4s/src/enforce/compounds/__tests__/allOf.test.js b/packages/n4s/src/enforce/compounds/__tests__/allOf.test.js index eeed55a98..b5169b082 100644 --- a/packages/n4s/src/enforce/compounds/__tests__/allOf.test.js +++ b/packages/n4s/src/enforce/compounds/__tests__/allOf.test.js @@ -9,9 +9,9 @@ describe('allOf validation', () => { ); }); it('Should succeed when all of the rules applies', () => { - expect( - allOf('test', enforce.isString(), enforce.longerThan(3)) - ).toBe(true); + expect(allOf('test', enforce.isString(), enforce.longerThan(3))).toBe( + true + ); }); it('Should fail with no rules', () => { expect(allOf(3)).toBe(true); @@ -29,37 +29,37 @@ describe('allOf validation', () => { }), }) ); - + const DisabledAccount = enforce.template( enforce.loose({ - disabled: enforce.equals(true) + disabled: enforce.equals(true), }) - ) - + ); + it('Should validate allof the rules correctly', () => { - enforce( - { id: 123, name : { first: 'Albert', last: 'Einstein' } ,disabled: true } - ).allOf( - User, DisabledAccount - ); + enforce({ + id: 123, + name: { first: 'Albert', last: 'Einstein' }, + disabled: true, + }).allOf(User, DisabledAccount); }); - it('Should throw if one of the rules fail', () =>{ - expect( () => { - enforce( - { id: 123, name : { first: 'Albert', last: 0 } ,disabled: true } - ).allOf( - User, DisabledAccount - ); + it('Should throw if one of the rules fail', () => { + expect(() => { + enforce({ + id: 123, + name: { first: 'Albert', last: 0 }, + disabled: true, + }).allOf(User, DisabledAccount); }).toThrow(); expect(() => { - enforce( - { id: 123, name : { first: 'Albert', last: 'Einstein' } ,disabled: false } - ).allOf( - User, DisabledAccount - ); + enforce({ + id: 123, + name: { first: 'Albert', last: 'Einstein' }, + disabled: false, + }).allOf(User, DisabledAccount); }).toThrow(); - }) + }); }); }); diff --git a/packages/n4s/src/enforce/compounds/__tests__/anyOf.test.js b/packages/n4s/src/enforce/compounds/__tests__/anyOf.test.js index eaebc668f..0779d4df8 100644 --- a/packages/n4s/src/enforce/compounds/__tests__/anyOf.test.js +++ b/packages/n4s/src/enforce/compounds/__tests__/anyOf.test.js @@ -26,7 +26,6 @@ describe('AnyOf validation', () => { expect(anyOf(5)).toBe(true); }); }); - describe('As part of enforce', () => { it('Should validate anyof the rules correctly', () => { enforce(77).anyOf( @@ -34,7 +33,6 @@ describe('AnyOf validation', () => { enforce.isNumber(), enforce.isUndefined() ); - expect(() => enforce({ test: 4 }).anyOf(enforce.isNumber(), enforce.isUndefined()) ).toThrow(); diff --git a/packages/n4s/src/enforce/compounds/compounds.js b/packages/n4s/src/enforce/compounds/compounds.js index 68c1879bb..7f2308a19 100644 --- a/packages/n4s/src/enforce/compounds/compounds.js +++ b/packages/n4s/src/enforce/compounds/compounds.js @@ -1,12 +1,12 @@ -import anyOf from 'anyOf'; import allOf from 'allOf'; +import anyOf from 'anyOf'; import isArrayOf from 'isArrayOf'; import optional from 'optional'; import { shape, loose } from 'shape'; export default { - anyOf, allOf, + anyOf, isArrayOf, loose, optional,