WIP create user

This commit is contained in:
Grégoire Chevalier 2023-05-05 10:49:42 +02:00
parent c33a0c8292
commit 393105d525
4 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import { CreateAdRequest } from '../domain/dtos/create-ad.request';
export class CreateAdCommand {
readonly createAdRequest: CreateAdRequest;
constructor(request: CreateAdRequest) {
this.createAdRequest = request;
}
}

View File

@ -0,0 +1 @@
export class CreateAdRequest {}

View File

@ -1,6 +1,8 @@
import { classes } from '@automapper/classes';
import { AutomapperModule } from '@automapper/nestjs';
import { Ad } from '../../domain/entities/ad';
import { Test, TestingModule } from '@nestjs/testing';
import { CreateAdUseCase } from '../../domain/usecases/create-ad.usecase';
const mockAddress1: Address = {
position: 0,
lon: '48.68944505415954',
@ -41,7 +43,25 @@ const mockMessager = {
describe('CreateAdUseCase', () => {
it('should be defined', () => {});
let createAdUseCase: CreateAdUseCase;
beforeAll(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [],
providers: [
{
provide: AdsRepository,
useValue: mockAdRepository,
},
{
provide: Messager,
useValue: mockMessager,
},
CreateAdUseCase,
],
}).compile();
createAdUseCase = module.get<CreateAdUseCase>(CreateAdUseCase);
});
describe('execution', () => {
it('should create an new ad', () => {});
it('should throw an error if the ad already exists', () => {});