Add 4 new Mustache templates for generating unit test specs: - model-entity.spec.mustache: tests instantiation, property setting, mock builder - mapper.spec.mustache: tests per-property DTO→Entity mapping, instanceof, all fields - api.repository.impl.spec.mustache: tests HTTP method, response mapping, error propagation - api.use-cases.impl.spec.mustache: tests repository delegation, observable forwarding Generator changes: - Add uppercaseHttpMethod to TagOperation for spec HTTP assertions - Add testValue to TagOperationParam for auto-generated test arguments - Add resolveTestParamValue utility for primitive/complex type test literals - Add specs counter to GeneratedCount and GenerationReport - Wire 4 new renderTemplate calls in schema and tag loops - Update report generator to count .spec.ts files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
40 lines
971 B
Plaintext
40 lines
971 B
Plaintext
{{#models}}
|
|
{{#model}}
|
|
import { {{classVarName}}Mapper } from './{{classFilename}}.mapper';
|
|
|
|
import { mock{{classname}}Dto } from '@/dtos/{{classFilename}}.dto.mock';
|
|
import { {{classname}} } from '@/entities/models/{{classFilename}}.model';
|
|
|
|
describe('{{classVarName}}Mapper', () => {
|
|
{{#vars}}
|
|
it('should map {{name}} from DTO to model', () => {
|
|
const dto = mock{{classname}}Dto();
|
|
|
|
const result = {{classVarName}}Mapper(dto);
|
|
|
|
expect(result.{{name}}).toBe(dto.{{name}});
|
|
});
|
|
|
|
{{/vars}}
|
|
it('should return an instance of {{classname}}', () => {
|
|
const dto = mock{{classname}}Dto();
|
|
|
|
const result = {{classVarName}}Mapper(dto);
|
|
|
|
expect(result).toBeInstanceOf({{classname}});
|
|
});
|
|
|
|
it('should map all fields correctly from a complete DTO', () => {
|
|
const dto = mock{{classname}}Dto();
|
|
|
|
const result = {{classVarName}}Mapper(dto);
|
|
|
|
{{#vars}}
|
|
expect(result.{{name}}).toBe(dto.{{name}});
|
|
{{/vars}}
|
|
});
|
|
});
|
|
|
|
{{/model}}
|
|
{{/models}}
|