Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/unit/swagger/templateHelpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,16 @@ describe('ValidationService', () => {
expect(error[`${name}.$2`].value).to.equal(true);
});

it('should error on invalid array enum value', () => {
const name = 'name';
const error: any = {};
const values = ['WRONG', 'HI'];
const result = new ValidationService({}).validateArray(name, values, error, {}, { dataType: 'enum', enums: ['LO', 'HI'] });
expect(result).to.deep.equal([undefined, 'HI']);
expect(error[`${name}.$0`].message).to.equal("should be one of the following; ['LO', 'HI']");
expect(error[`${name}.$0`].value).to.equal('WRONG');
});

it('should array minItems validate', () => {
const name = 'name';
const value = [80, 10, 199];
Expand Down
Loading