-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(apps-backend, tooling-ci): Add e2e tests to apps backend (#3760)
* feat(apps-backend): add e2e tests. * feat(apps-backend): add e2e tests to CI for testing. * feat(apps-backend): move e2e tests to another config. * feat(apps-backend): revert hierarchy. * feat(apps-backend): remove DEPLOY_URL * feat(apps-backend): remove DEPLOY_URL from e2e test * feat(tooling-ci): move e2e tests for apps-backend to e2e.yml * feat(apps-backend): Run apps-backend e2e tests conditionally on apps-backend changes * feat(apps-backend): Run apps-backend e2e tests also on merge to develop --------- Co-authored-by: Mario Sarcevic <[email protected]> Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
- Loading branch information
1 parent
7796881
commit a7d4447
Showing
8 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"moduleFileExtensions": ["js", "json", "ts"], | ||
"rootDir": "./", | ||
"testRegex": ".e2e-spec.ts$", | ||
"transform": { | ||
"^.+\\.(t|j)s$": "ts-jest" | ||
}, | ||
"testEnvironment": "node", | ||
"moduleNameMapper": { | ||
"^src/(.*)$": "<rootDir>/dist/$1", | ||
"^@iota/core/(.*)$": "<rootDir>/dist/core/src/$1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Controller, Get } from '@nestjs/common'; | ||
|
||
@Controller('health') | ||
export class HealthController { | ||
@Get() | ||
check() { | ||
return { status: 'ok' }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Module } from '@nestjs/common'; | ||
import { HealthController } from './health.controller'; | ||
|
||
@Module({ | ||
controllers: [HealthController], | ||
}) | ||
export class HealthModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { INestApplication } from '@nestjs/common'; | ||
import * as request from 'supertest'; | ||
import { AppModule } from '../src/app.module'; | ||
|
||
describe('Health Check (e2e)', () => { | ||
let app: INestApplication; | ||
|
||
beforeAll(async () => { | ||
const moduleFixture: TestingModule = await Test.createTestingModule({ | ||
imports: [AppModule], | ||
}).compile(); | ||
|
||
app = moduleFixture.createNestApplication(); | ||
await app.init(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await app.close(); | ||
}); | ||
|
||
it('/health (GET)', async () => { | ||
await request(app.getHttpServer()).get('/health').expect(200).expect({ status: 'ok' }); | ||
}); | ||
}); |