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>
35 lines
823 B
Plaintext
35 lines
823 B
Plaintext
{{#models}}
|
|
{{#model}}
|
|
import { {{classname}} } from './{{classFilename}}.model';
|
|
import { mock{{classname}}Model } from './{{classFilename}}.model.mock';
|
|
|
|
describe('{{classname}}', () => {
|
|
it('should create an instance', () => {
|
|
const model = new {{classname}}();
|
|
|
|
expect(model).toBeInstanceOf({{classname}});
|
|
});
|
|
|
|
{{#vars}}
|
|
it('should allow setting {{name}}', () => {
|
|
const model = new {{classname}}();
|
|
const expected = mock{{classname}}Model();
|
|
model.{{name}} = expected.{{name}};
|
|
|
|
expect(model.{{name}}).toBe(expected.{{name}});
|
|
});
|
|
|
|
{{/vars}}
|
|
it('should build a valid model from mock', () => {
|
|
const model = mock{{classname}}Model();
|
|
|
|
expect(model).toBeInstanceOf({{classname}});
|
|
{{#vars}}
|
|
expect(model.{{name}}).toBeDefined();
|
|
{{/vars}}
|
|
});
|
|
});
|
|
|
|
{{/model}}
|
|
{{/models}}
|