diff --git a/src/modules/ad/domain/dtos/utils/frequency.mapping.ts b/src/modules/ad/domain/dtos/utils/frequency.mapping.ts index 8749ad0..4d59786 100644 --- a/src/modules/ad/domain/dtos/utils/frequency.mapping.ts +++ b/src/modules/ad/domain/dtos/utils/frequency.mapping.ts @@ -1,5 +1,4 @@ import { Frequency } from '../../types/frequency.enum'; export const mappingKeyToFrequency = (index: number): string => { - console.log(Frequency[index - 1]); return Frequency[index - 1]; }; diff --git a/src/modules/ad/domain/entities/ReccurentNormaliser.ts b/src/modules/ad/domain/entities/reccurent-normaliser.ts similarity index 100% rename from src/modules/ad/domain/entities/ReccurentNormaliser.ts rename to src/modules/ad/domain/entities/reccurent-normaliser.ts diff --git a/src/modules/ad/mappers/ad.profile.ts b/src/modules/ad/mappers/ad.profile.ts index 6763a29..4c0b701 100644 --- a/src/modules/ad/mappers/ad.profile.ts +++ b/src/modules/ad/mappers/ad.profile.ts @@ -5,7 +5,7 @@ import { Ad } from '../domain/entities/ad'; import { AdPresenter } from '../adapters/primaries/ad.presenter'; import { CreateAdRequest } from '../domain/dtos/create-ad.request'; import { AdCreation } from '../domain/dtos/ad.creation'; -import { ReccurentNormaliser } from '../domain/entities/ReccurentNormaliser'; +import { ReccurentNormaliser } from '../domain/entities/reccurent-normaliser'; @Injectable() export class AdProfile extends AutomapperProfile { diff --git a/src/modules/ad/tests/integration/ad.repository.spec.ts b/src/modules/ad/tests/integration/ad.repository.spec.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/modules/ad/tests/unit/adapters/secondaries/default-param.provider.spec.ts b/src/modules/ad/tests/unit/adapters/secondaries/default-param.provider.spec.ts new file mode 100644 index 0000000..14c1f83 --- /dev/null +++ b/src/modules/ad/tests/unit/adapters/secondaries/default-param.provider.spec.ts @@ -0,0 +1,40 @@ +import { ConfigService } from '@nestjs/config'; +import { Test, TestingModule } from '@nestjs/testing'; +import { DefaultParamsProvider } from '../../../../adapters/secondaries/default-params.provider'; +import { DefaultParams } from '../../../../domain/types/default-params.type'; + +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, + ); + }); + + it('should be defined', () => { + expect(defaultParamsProvider).toBeDefined(); + }); + + it('should provide default params', async () => { + const params: DefaultParams = defaultParamsProvider.getParams(); + expect(params.SUN_MARGIN).toBe('some_default_value'); + expect(params.PASSENGER).toBe(false); + expect(params.DRIVER).toBe(false); + }); +}); diff --git a/src/modules/ad/tests/unit/messager.spec.ts b/src/modules/ad/tests/unit/adapters/secondaries/messager.spec.ts similarity index 94% rename from src/modules/ad/tests/unit/messager.spec.ts rename to src/modules/ad/tests/unit/adapters/secondaries/messager.spec.ts index 2296553..b487762 100644 --- a/src/modules/ad/tests/unit/messager.spec.ts +++ b/src/modules/ad/tests/unit/adapters/secondaries/messager.spec.ts @@ -1,7 +1,7 @@ import { AmqpConnection } from '@golevelup/nestjs-rabbitmq'; import { ConfigService } from '@nestjs/config'; import { Test, TestingModule } from '@nestjs/testing'; -import { Messager } from '../../adapters/secondaries/messager'; +import { Messager } from '../../../../adapters/secondaries/messager'; const mockAmqpConnection = { publish: jest.fn().mockImplementation(), diff --git a/src/modules/ad/tests/unit/create-ad.usecase.spec.ts b/src/modules/ad/tests/unit/domain/create-ad.usecase.spec.ts similarity index 91% rename from src/modules/ad/tests/unit/create-ad.usecase.spec.ts rename to src/modules/ad/tests/unit/domain/create-ad.usecase.spec.ts index 644d8ee..490636e 100644 --- a/src/modules/ad/tests/unit/create-ad.usecase.spec.ts +++ b/src/modules/ad/tests/unit/domain/create-ad.usecase.spec.ts @@ -1,17 +1,17 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { CreateAdUseCase } from '../../domain/usecases/create-ad.usecase'; -import { CreateAdRequest } from '../../domain/dtos/create-ad.request'; -import { Messager } from '../../adapters/secondaries/messager'; -import { AdsRepository } from '../../adapters/secondaries/ads.repository'; -import { CreateAdCommand } from '../../commands/create-ad.command'; +import { CreateAdUseCase } from '../../../domain/usecases/create-ad.usecase'; +import { CreateAdRequest } from '../../../domain/dtos/create-ad.request'; +import { Messager } from '../../../adapters/secondaries/messager'; +import { AdsRepository } from '../../../adapters/secondaries/ads.repository'; +import { CreateAdCommand } from '../../../commands/create-ad.command'; import { AutomapperModule } from '@automapper/nestjs'; import { classes } from '@automapper/classes'; -import { Frequency } from '../../domain/types/frequency.enum'; -import { Ad } from '../../domain/entities/ad'; -import { AdProfile } from '../../mappers/ad.profile'; -import { AddressRequestDTO } from '../../domain/dtos/create.address.request'; -import { AdCreation } from '../../domain/dtos/ad.creation'; -import { AddressCreation } from '../../domain/dtos/address.creation'; +import { Frequency } from '../../../domain/types/frequency.enum'; +import { Ad } from '../../../domain/entities/ad'; +import { AdProfile } from '../../../mappers/ad.profile'; +import { AddressRequestDTO } from '../../../domain/dtos/create.address.request'; +import { AdCreation } from '../../../domain/dtos/ad.creation'; +import { AddressCreation } from '../../../domain/dtos/address.creation'; const mockAddress1: AddressRequestDTO = { position: 0, diff --git a/src/modules/ad/tests/unit/find-ad-by-uuid.usecase.spec.ts b/src/modules/ad/tests/unit/domain/find-ad-by-uuid.usecase.spec.ts similarity index 83% rename from src/modules/ad/tests/unit/find-ad-by-uuid.usecase.spec.ts rename to src/modules/ad/tests/unit/domain/find-ad-by-uuid.usecase.spec.ts index d176d96..43635d7 100644 --- a/src/modules/ad/tests/unit/find-ad-by-uuid.usecase.spec.ts +++ b/src/modules/ad/tests/unit/domain/find-ad-by-uuid.usecase.spec.ts @@ -1,10 +1,10 @@ import { NotFoundException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { Messager } from '../../adapters/secondaries/messager'; -import { FindAdByUuidQuery } from '../../queries/find-ad-by-uuid.query'; -import { AdsRepository } from '../../adapters/secondaries/ads.repository'; -import { FindAdByUuidUseCase } from '../../domain/usecases/find-ad-by-uuid.usecase'; -import { FindAdByUuidRequest } from '../../domain/dtos/find-ad-by-uuid.request'; +import { Messager } from '../../../adapters/secondaries/messager'; +import { FindAdByUuidQuery } from '../../../queries/find-ad-by-uuid.query'; +import { AdsRepository } from '../../../adapters/secondaries/ads.repository'; +import { FindAdByUuidUseCase } from '../../../domain/usecases/find-ad-by-uuid.usecase'; +import { FindAdByUuidRequest } from '../../../domain/dtos/find-ad-by-uuid.request'; const mockAd = { uuid: 'bb281075-1b98-4456-89d6-c643d3044a91', diff --git a/src/modules/ad/tests/unit/frequency.mapping.spec.ts b/src/modules/ad/tests/unit/domain/frequency.mapping.spec.ts similarity index 73% rename from src/modules/ad/tests/unit/frequency.mapping.spec.ts rename to src/modules/ad/tests/unit/domain/frequency.mapping.spec.ts index 1fbf9a2..063fc7f 100644 --- a/src/modules/ad/tests/unit/frequency.mapping.spec.ts +++ b/src/modules/ad/tests/unit/domain/frequency.mapping.spec.ts @@ -1,5 +1,5 @@ -import { mappingKeyToFrequency } from '../../domain/dtos/utils/frequency.mapping'; -import { Frequency } from '../../domain/types/frequency.enum'; +import { mappingKeyToFrequency } from '../../../domain/dtos/utils/frequency.mapping'; +import { Frequency } from '../../../domain/types/frequency.enum'; describe('frequency mapping function ', () => { it('should return punctual', () => { diff --git a/src/modules/ad/tests/unit/has-driver-seats-validator.spec.ts b/src/modules/ad/tests/unit/domain/has-driver-seats-validator.spec.ts similarity index 96% rename from src/modules/ad/tests/unit/has-driver-seats-validator.spec.ts rename to src/modules/ad/tests/unit/domain/has-driver-seats-validator.spec.ts index 3859b0c..7542422 100644 --- a/src/modules/ad/tests/unit/has-driver-seats-validator.spec.ts +++ b/src/modules/ad/tests/unit/domain/has-driver-seats-validator.spec.ts @@ -1,4 +1,4 @@ -import { hasProperDriverSeats } from '../../domain/dtos/utils/has-driver-seats.validator'; +import { hasProperDriverSeats } from '../../../domain/dtos/utils/has-driver-seats.validator'; describe('driver and/or driver seats validator', () => { it('should validate if driver and drivers seats is not provided ', () => { diff --git a/src/modules/ad/tests/unit/has-passenger-seats-validator.spec.ts b/src/modules/ad/tests/unit/domain/has-passenger-seats-validator.spec.ts similarity index 96% rename from src/modules/ad/tests/unit/has-passenger-seats-validator.spec.ts rename to src/modules/ad/tests/unit/domain/has-passenger-seats-validator.spec.ts index 065a9d8..2935eef 100644 --- a/src/modules/ad/tests/unit/has-passenger-seats-validator.spec.ts +++ b/src/modules/ad/tests/unit/domain/has-passenger-seats-validator.spec.ts @@ -1,4 +1,4 @@ -import { hasProperPassengerSeats } from '../../domain/dtos/utils/has-passenger-seats.validator'; +import { hasProperPassengerSeats } from '../../../domain/dtos/utils/has-passenger-seats.validator'; describe('driver and/or passenger seats validator', () => { it('should validate if passenger and passengers seats is not provided ', () => { diff --git a/src/modules/ad/tests/unit/has-proper-addresses-indexes.spec.ts b/src/modules/ad/tests/unit/domain/has-proper-addresses-indexes.spec.ts similarity index 91% rename from src/modules/ad/tests/unit/has-proper-addresses-indexes.spec.ts rename to src/modules/ad/tests/unit/domain/has-proper-addresses-indexes.spec.ts index 7bf1efe..edbc45b 100644 --- a/src/modules/ad/tests/unit/has-proper-addresses-indexes.spec.ts +++ b/src/modules/ad/tests/unit/domain/has-proper-addresses-indexes.spec.ts @@ -1,5 +1,5 @@ -import { AddressRequestDTO } from '../../domain/dtos/create.address.request'; -import { hasProperPositionIndexes } from '../../domain/dtos/utils/address-position.validator'; +import { AddressRequestDTO } from '../../../domain/dtos/create.address.request'; +import { hasProperPositionIndexes } from '../../../domain/dtos/utils/address-position.validator'; describe('addresses position validators', () => { const mockAddress1: AddressRequestDTO = { lon: 48.68944505415954, diff --git a/src/modules/ad/tests/unit/reccurentNormaliser.spec.ts b/src/modules/ad/tests/unit/domain/reccurent-normaliser.spec.ts similarity index 92% rename from src/modules/ad/tests/unit/reccurentNormaliser.spec.ts rename to src/modules/ad/tests/unit/domain/reccurent-normaliser.spec.ts index f507c73..f790b3c 100644 --- a/src/modules/ad/tests/unit/reccurentNormaliser.spec.ts +++ b/src/modules/ad/tests/unit/domain/reccurent-normaliser.spec.ts @@ -1,7 +1,7 @@ -import { CreateAdRequest } from '../../domain/dtos/create-ad.request'; -import { ScheduleDTO } from '../../domain/dtos/create.schedule.dto'; -import { ReccurentNormaliser } from '../../domain/entities/ReccurentNormaliser'; -import { Frequency } from '../../domain/types/frequency.enum'; +import { CreateAdRequest } from '../../../domain/dtos/create-ad.request'; +import { ScheduleDTO } from '../../../domain/dtos/create.schedule.dto'; +import { ReccurentNormaliser } from '../../../domain/entities/reccurent-normaliser'; +import { Frequency } from '../../../domain/types/frequency.enum'; describe('reccurent normalizer transformer for punctual ad ', () => { const reccurentNormaliser = new ReccurentNormaliser(); it('should transform punctual ad into reccurent ad ', () => {