Skip to content

Commit

Permalink
fix tests ealush#521
Browse files Browse the repository at this point in the history
  • Loading branch information
Moses3301 committed Nov 29, 2020
1 parent 819ab2f commit a636408
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"prettier-watch": "onchange '**/*.js' '**/*.json' -- prettier --write {{changed}}",
"dev": "onchange -i './packages/**/src/**/*.js' -- yarn genJSConfig",
"genJSConfig": "node ./scripts/genJsconfig",
"test": "jest --projects ./packages/n4s",
"test": "jest --projects ./packages/*",
"lint": "eslint . --ignore-path .gitignore",
"pretest": "yarn genJSConfig",
"docs": "node scripts/release/steps/updateDocs"
Expand Down
25 changes: 14 additions & 11 deletions packages/n4s/src/enforce/compounds/__tests__/allOf.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,29 @@ describe('allOf validation', () => {
)

it('Should validate allof the rules correctly', () => {
enforce(value).allOf(
{ id: 123, name : { first: 'Albert', last: 'Einstein' } },
{ disabled: true }
enforce(
{ id: 123, name : { first: 'Albert', last: 'Einstein' } ,disabled: true }
).allOf(
User, DisabledAccount
);
});

it('Should throw if one of the rules fail', () =>{
expect( () => {
enforce(value).allOf(
{ id: 123, name : { first: 'Albert', last: 0 } },
{ disabled: true }
enforce(
{ id: 123, name : { first: 'Albert', last: 0 } ,disabled: true }
).allOf(
User, DisabledAccount
);
}).toThrow();

expect( () => {
enforce(value).allOf(
{ id: 123, name : { first: 'Albert', last: 'Einstein' } },
{ disabled: false }
expect(() => {
enforce(
{ id: 123, name : { first: 'Albert', last: 'Einstein' } ,disabled: false }
).allOf(
User, DisabledAccount
);
}).toThrow();
} )
})
});
});
2 changes: 1 addition & 1 deletion packages/n4s/src/enforce/compounds/allOf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ function allOf(value, rules) {
);
}

export default withFirst(anyOf);
export default withFirst(allOf);

0 comments on commit a636408

Please sign in to comment.