Skip to content

Commit

Permalink
Merge pull request #1497 from rodekruis/wip.email-multi-event-api-test
Browse files Browse the repository at this point in the history
AB#27263 First setup api test: uga floods
  • Loading branch information
gulfaraz authored Jul 4, 2024
2 parents 18edcb6 + c841b6e commit 6861624
Show file tree
Hide file tree
Showing 27 changed files with 621 additions and 163 deletions.
4 changes: 4 additions & 0 deletions services/API-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ For the rest, follow the same instructions as above to receive initial and follo
- Endpoint URL: `https://ibf.510.global/api/point-data/community-notification/${countryCodeISO3}`
- To test this locally you can replace `ibf.510.global` by a local ngrok address
- To demo on other environments, replace by respective environment-url, e.g. `ibf-test.510.global`

## API tests

1. Run them by `docker exec ibf-api-service npm run test:api:all`
16 changes: 16 additions & 0 deletions services/API-service/jest.api.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
moduleFileExtensions: ['js', 'ts'],
transform: {
'^.+\\.ts?$': ['ts-jest', { tsconfig: '<rootDir>/test/tsconfig.json' }],
},
rootDir: '.',
testMatch: ['<rootDir>/test/**/*.test.ts'],
coverageReporters: ['json', 'lcov'],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
testTimeout: 30_000,
verbose: true,
reporters: ['default'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export class RenameMockRasters1710512991479 implements MigrationInterface {

if (fs.existsSync(directoryPath)) {
const files = fs.readdirSync(directoryPath);
console.log('🚀 ~ RenameMockRasters1710512991479 ~ up ~ files:', files);

files.forEach((file) => {
if (!file.includes('hour_MWI')) {
const newFilename = file.replace(
Expand Down
2 changes: 2 additions & 0 deletions services/API-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"test": "jest --config=jest.json --detectOpenHandles --forceExit --passWithNoTests",
"test:dev": "npm test -- --watchAll",
"test:coverage": "npm test -- --coverage --coverageDirectory=coverage",
"test:api:all": "node --expose-gc node_modules/.bin/jest --config=jest.api.config.js --runInBand --detectOpenHandles --logHeapUsage",
"test:api:watch": "npm run test:api:all -- --watchAll",
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js",
"migration:generate": "npm run typeorm migration:generate -- -d ./appdatasource.ts",
"migration:run": "npm run typeorm migration:run -- -d ./appdatasource.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export class NotificationApiTestResponseDto {
activeEvents: NotificationApiTestResponseChannelDto;
finishedEvents: NotificationApiTestResponseChannelDto;
}

export class NotificationApiTestResponseChannelDto {
email: string;
whatsapp: string;
}
Loading

0 comments on commit 6861624

Please sign in to comment.