feat: expose safe build metadata and verify foundation
This commit is contained in:
33
backend/apps/api/src/version/version.controller.spec.ts
Normal file
33
backend/apps/api/src/version/version.controller.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Test } from '@nestjs/testing';
|
||||
import {
|
||||
APP_ENVIRONMENT,
|
||||
AppEnvironment,
|
||||
} from '../../../../libs/configuration/src';
|
||||
import { VersionController } from './version.controller';
|
||||
|
||||
describe('VersionController', () => {
|
||||
it('returns only safe build metadata', async () => {
|
||||
const environment: AppEnvironment = {
|
||||
databaseUrl: 'postgresql://u:p@postgres:5432/db',
|
||||
redisUrl: 'redis://redis:6379',
|
||||
appVersion: '1.0.0',
|
||||
teamCityBuildNumber: '123',
|
||||
sourceRevision: 'abc123',
|
||||
};
|
||||
|
||||
const moduleRef = await Test.createTestingModule({
|
||||
controllers: [VersionController],
|
||||
providers: [{ provide: APP_ENVIRONMENT, useValue: environment }],
|
||||
}).compile();
|
||||
|
||||
const response = moduleRef.get(VersionController).version();
|
||||
|
||||
expect(response).toEqual({
|
||||
appVersion: '1.0.0',
|
||||
teamCityBuildNumber: '123',
|
||||
sourceRevision: 'abc123',
|
||||
});
|
||||
expect(response).not.toHaveProperty('databaseUrl');
|
||||
expect(response).not.toHaveProperty('redisUrl');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user