Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matt committed Jan 22, 2020
1 parent 7a4ead3 commit 1d5f452
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/openapi-v3/src/__tests__/unit/x-ts-type.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import {Model, model, property} from '@loopback/repository';
import {expect} from '@loopback/testlab';
import {RequestBodyObject, ResponseObject} from 'openapi3-ts';
import {getControllerSpec} from '../../..';
import {getControllerSpec} from '../..';
import {get, post, requestBody} from '../../decorators';

describe('x-ts-type is converted in the right places', () => {
Expand Down Expand Up @@ -33,6 +33,15 @@ describe('x-ts-type is converted in the right places', () => {
foo: string;
}

@model()
class NotError extends Model {
constructor(err: Partial<NotError>) {
super(err);
}
@property({default: true})
fail: boolean;
}

@model()
class BarError extends Model {
constructor(err: Partial<BarError>) {
Expand Down Expand Up @@ -81,6 +90,7 @@ describe('x-ts-type is converted in the right places', () => {
{$ref: '#/components/schemas/FooError'},
{$ref: '#/components/schemas/BarError'},
],
not: {$ref: '#/components/schemas/NotError'},
},
},
},
Expand Down Expand Up @@ -134,6 +144,7 @@ describe('x-ts-type is converted in the right places', () => {
'application/json': {
schema: {
anyOf: [{'x-ts-type': FooError}, {'x-ts-type': BarError}],
not: {'x-ts-type': NotError},
},
},
},
Expand All @@ -159,6 +170,7 @@ describe('x-ts-type is converted in the right places', () => {
'application/json': {
schema: {
allOf: [{'x-ts-type': FooError}, {'x-ts-type': BarError}],
not: {'x-ts-type': NotError},
},
},
},
Expand All @@ -185,6 +197,7 @@ describe('x-ts-type is converted in the right places', () => {
'application/json': {
schema: {
oneOf: [{'x-ts-type': FooError}, {'x-ts-type': BarError}],
not: {'x-ts-type': NotError},
},
},
},
Expand Down

0 comments on commit 1d5f452

Please sign in to comment.