Skip to content

Commit

Permalink
Add new tests to duplicate field validation
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares committed Oct 7, 2020
1 parent 0d4d820 commit 6b505c9
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,28 @@ describe('When invoking Trusted Apps Schema', () => {
});

it('should validate that `entry.field` is used only once', () => {
const bodyMsg = {
let bodyMsg = {
...getCreateTrustedAppItem(),
entries: [getTrustedAppItemEntryItem(), getTrustedAppItemEntryItem()],
};
expect(() => body.validate(bodyMsg)).toThrow();
expect(() => body.validate(bodyMsg)).toThrow('[Path] field can only be used once');

bodyMsg = {
...getCreateTrustedAppItem(),
entries: [
{
...getTrustedAppItemEntryItem(),
field: 'process.hash.*',
value: VALID_HASH_MD5,
},
{
...getTrustedAppItemEntryItem(),
field: 'process.hash.*',
value: VALID_HASH_MD5,
},
],
};
expect(() => body.validate(bodyMsg)).toThrow('[Hash] field can only be used once');
});

it('should validate Hash field valid value', () => {
Expand Down

0 comments on commit 6b505c9

Please sign in to comment.