matcher/old/modules/ad/tests/unit/adapters/secondaries/default-params.provider.spe...

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-05-11 15:47:55 +00:00
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { DefaultParamsProvider } from '../../../../adapters/secondaries/default-params.provider';
2023-05-12 14:23:42 +00:00
import { DefaultParams } from '../../../../domain/types/default-params.type';
2023-05-11 15:47:55 +00:00
const mockConfigService = {
get: jest.fn().mockImplementation(() => 'some_default_value'),
};
describe('DefaultParamsProvider', () => {
let defaultParamsProvider: DefaultParamsProvider;
beforeAll(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [],
providers: [
DefaultParamsProvider,
{
provide: ConfigService,
useValue: mockConfigService,
},
],
}).compile();
defaultParamsProvider = module.get<DefaultParamsProvider>(
DefaultParamsProvider,
);
});
it('should be defined', () => {
expect(defaultParamsProvider).toBeDefined();
});
it('should provide default params', async () => {
2023-05-12 14:23:42 +00:00
const params: DefaultParams = defaultParamsProvider.getParams();
2023-05-11 15:47:55 +00:00
expect(params.GEOROUTER_URL).toBe('some_default_value');
});
});