mirror of
https://gitlab.com/mobicoop/v3/service/ad.git
synced 2026-01-30 03:00:45 +00:00
WIP create user
This commit is contained in:
9
src/modules/ad/commands/create-ad.command.ts
Normal file
9
src/modules/ad/commands/create-ad.command.ts
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/modules/ad/domain/dtos/create-ad.request.ts
Normal file
1
src/modules/ad/domain/dtos/create-ad.request.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export class CreateAdRequest {}
|
||||||
0
src/modules/ad/domain/entities/address.ts
Normal file
0
src/modules/ad/domain/entities/address.ts
Normal file
@@ -1,6 +1,8 @@
|
|||||||
import { classes } from '@automapper/classes';
|
import { classes } from '@automapper/classes';
|
||||||
import { AutomapperModule } from '@automapper/nestjs';
|
import { AutomapperModule } from '@automapper/nestjs';
|
||||||
import { Ad } from '../../domain/entities/ad';
|
import { Ad } from '../../domain/entities/ad';
|
||||||
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
import { CreateAdUseCase } from '../../domain/usecases/create-ad.usecase';
|
||||||
const mockAddress1: Address = {
|
const mockAddress1: Address = {
|
||||||
position: 0,
|
position: 0,
|
||||||
lon: '48.68944505415954',
|
lon: '48.68944505415954',
|
||||||
@@ -41,7 +43,25 @@ const mockMessager = {
|
|||||||
|
|
||||||
describe('CreateAdUseCase', () => {
|
describe('CreateAdUseCase', () => {
|
||||||
it('should be defined', () => {});
|
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', () => {
|
describe('execution', () => {
|
||||||
it('should create an new ad', () => {});
|
it('should create an new ad', () => {});
|
||||||
it('should throw an error if the ad already exists', () => {});
|
it('should throw an error if the ad already exists', () => {});
|
||||||
|
|||||||
Reference in New Issue
Block a user