Skip to content

Commit

Permalink
Add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
keslerm committed Oct 3, 2023
1 parent a3ee02a commit df72c6a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/fixtures/controllers/getController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ export class GetTestController extends Controller {
return new ModelService().getModel();
}

@Get('StringValue')
public async getStringValue(): Promise<string> {
return 'FOO';
}

@Get('IndexedValue')
public async getIndexedValue(): Promise<IndexedValue> {
return 'FOO';
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/express-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ describe('Express Server', () => {
});
});

it('returns string responses', () => {
return verifyGetRequest(`${basePath}/GetTest/StringValue`, (_err, res) => {
expect(res.text).to.equal('FOO');
return;
});
});

it('should reject invalid additionalProperties', () => {
const invalidValues = ['invalid', null, [], 1, { foo: null }, { foo: 1 }, { foo: [] }, { foo: {} }, { foo: { foo: 'bar' } }];

Expand Down
7 changes: 7 additions & 0 deletions tests/integration/hapi-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ describe('Hapi Server', () => {
});
});

it('returns string responses', () => {
return verifyGetRequest(`${basePath}/GetTest/StringValue`, (_err, res) => {
expect(res.text).to.equal('FOO');
return;
});
});

it('can handle get request with collection return value', () => {
return verifyGetRequest(basePath + '/GetTest/Multi', (_err, res) => {
const models = res.body as TestModel[];
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/koa-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ describe('Koa Server', () => {
});
});

it('returns string responses', () => {
return verifyGetRequest(`${basePath}/GetTest/StringValue`, (_err, res) => {
expect(res.text).to.equal('FOO');
return;
});
});

it('can handle get request with path and query parameters', () => {
return verifyGetRequest(basePath + `/GetTest/${1}/true/test?booleanParam=true&stringParam=test1234&numberParam=1234`, (_err, res) => {
const model = res.body as TestModel;
Expand Down

0 comments on commit df72c6a

Please sign in to comment.