From df72c6afa3b0ff484ede57f4f3cc1dae0e35fe97 Mon Sep 17 00:00:00 2001 From: rridley Date: Fri, 8 Sep 2023 11:01:09 -0400 Subject: [PATCH] Add integration tests --- tests/fixtures/controllers/getController.ts | 5 +++++ tests/integration/express-server.spec.ts | 7 +++++++ tests/integration/hapi-server.spec.ts | 7 +++++++ tests/integration/koa-server.spec.ts | 7 +++++++ 4 files changed, 26 insertions(+) diff --git a/tests/fixtures/controllers/getController.ts b/tests/fixtures/controllers/getController.ts index 7dbfd6079..cf100ed28 100644 --- a/tests/fixtures/controllers/getController.ts +++ b/tests/fixtures/controllers/getController.ts @@ -308,6 +308,11 @@ export class GetTestController extends Controller { return new ModelService().getModel(); } + @Get('StringValue') + public async getStringValue(): Promise { + return 'FOO'; + } + @Get('IndexedValue') public async getIndexedValue(): Promise { return 'FOO'; diff --git a/tests/integration/express-server.spec.ts b/tests/integration/express-server.spec.ts index 7360dd9ad..63a5b8b76 100644 --- a/tests/integration/express-server.spec.ts +++ b/tests/integration/express-server.spec.ts @@ -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' } }]; diff --git a/tests/integration/hapi-server.spec.ts b/tests/integration/hapi-server.spec.ts index ac5663931..90b9d0863 100644 --- a/tests/integration/hapi-server.spec.ts +++ b/tests/integration/hapi-server.spec.ts @@ -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[]; diff --git a/tests/integration/koa-server.spec.ts b/tests/integration/koa-server.spec.ts index a50889b93..90df45432 100644 --- a/tests/integration/koa-server.spec.ts +++ b/tests/integration/koa-server.spec.ts @@ -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;