Skip to content

Commit 70a6939

Browse files
committed
chore: add e2e test
1 parent 3adcb91 commit 70a6939

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

__tests__/commands.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ describe('E2E', () => {
7474
const result = getCommandOutput(args, {}, { testPath });
7575
await expect(cleanupOutput(result)).toMatchFileSnapshot(join(testPath, 'snapshot_2.txt'));
7676
});
77+
78+
test('lint file with constructor property in schema', async () => {
79+
const testPath = join(__dirname, 'fixtures/constructor-property');
80+
const args = getParams(indexEntryPoint, ['lint', 'openapi.yaml']);
81+
82+
const result = getCommandOutput(args, {}, { testPath });
83+
await expect(cleanupOutput(result)).toMatchFileSnapshot(join(testPath, 'snapshot.txt'));
84+
});
7785
});
7886

7987
describe('zero-config', () => {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
openapi: 3.0.0
2+
servers:
3+
- url: http://test.com:3000
4+
info:
5+
title: Test API - Constructor Property
6+
version: 1.0.0
7+
license:
8+
name: MIT
9+
url: https://opensource.org/licenses/MIT
10+
components:
11+
schemas:
12+
SchemaWithConstructor:
13+
type: object
14+
properties:
15+
id:
16+
type: string
17+
constructor: # This is the property we are testing
18+
type: object
19+
description: "A property named constructor"
20+
properties:
21+
foo:
22+
type: string
23+
paths:
24+
/test:
25+
get:
26+
summary: Test endpoint
27+
security: []
28+
operationId: test
29+
responses:
30+
'200':
31+
description: OK
32+
content:
33+
application/json:
34+
schema:
35+
$ref: '#/components/schemas/SchemaWithConstructor'
36+
'400':
37+
description: Bad Request
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
No configurations were provided -- using built in recommended configuration by default.
3+
4+
validating openapi.yaml...
5+
openapi.yaml: validated in <test>ms
6+
7+
Woohoo! Your API description is valid. 🎉
8+

0 commit comments

Comments
 (0)