Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nulltoken committed Jan 17, 2020
1 parent 4fcf484 commit 025f28c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
35 changes: 15 additions & 20 deletions src/functions/__tests__/typedEnum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,23 @@ describe('typedEnum', () => {
});

describe('types', () => {
/*
string (this includes dates and files)
number
integer
boolean
array
object
*/
const testCases: Array<[string, unknown[], unknown]> = [
// cf. https://github.com/amazing-gao/ajv-oai/blob/master/README.md#example
['integer', [-2147483648, 17], 'Hello'],
// [`int64`, 'integer', [9223372036854775807, -127], 'Hello'],
// [`float`, 'number', [1.12, Math.pow(2, 128)], 'Hello'],
// [`double`, 'number', [-3.151, Math.pow(2, 1024) * -1], 'Hello'],
['string', ['Hello', 'world!'], 12],

// cf. https://github.com/epoberezkin/ajv/blob/master/README.md#formats
// [`time`, '', [], ''],
// [`date-time`, '', [], ''],
// [`uri`, '', [], ''],
// [`uri-reference`, '', [], ''],
// [`uri-template`, '', [], ''],
// [`email`, '', [], ''],
// [`hostname`, '', [], ''],
// [`ipv4`, '', [], ''],
// [`ipv6`, '', [], ''],
// [`regex`, '', [], ''],
// [`uuid`, '', [], ''],
// [`json-pointer`, '', [], ''],
// [`relative-json-pointer`, '', [], ''],
['number', [-2147483648, 17.13], 'Hello'],
['integer', [-2147483648, 17], 12.3],
['boolean', [true, false], 1],
// array ?
// object ?
];

test.each(testCases)(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ components:
- 12254
- You certainly wonder
- Why I gathered you all today...
format: int64
====command====
{bin} lint {document} --ruleset {asset:ruleset}
====stdout====
OpenAPI 3.x detected

{document}
7:12 error typed-enum Some enum values do not respect the specified format "int64": "Tap, tap, tap...", "Is thing thing on?", "You certainly wonder"...
7:12 error typed-enum Some enum values do not respect the specified type "integer": "Tap, tap, tap...", "Is thing thing on?", "You certainly wonder"...

✖ 1 problem (1 error, 0 warnings, 0 infos, 0 hints)

0 comments on commit 025f28c

Please sign in to comment.