integration tests
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m51s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped

This commit is contained in:
2026-01-24 01:13:49 +01:00
parent 9bb6b228f1
commit 9ccecbf3bb
25 changed files with 895 additions and 2688 deletions

View File

@@ -4,8 +4,8 @@ export class Position {
private constructor(private readonly value: number) {}
static create(value: number): Position {
if (!Number.isInteger(value) || value <= 0) {
throw new RacingDomainValidationError('Position must be a positive integer');
if (!Number.isInteger(value) || value < 0) {
throw new RacingDomainValidationError('Position must be a non-negative integer');
}
return new Position(value);
}

View File

@@ -20,6 +20,7 @@ export class Result extends Entity<string> {
readonly fastestLap: LapTime;
readonly incidents: IncidentCount;
readonly startPosition: Position;
readonly points: number;
private constructor(props: {
id: string;
@@ -29,6 +30,7 @@ export class Result extends Entity<string> {
fastestLap: LapTime;
incidents: IncidentCount;
startPosition: Position;
points: number;
}) {
super(props.id);
@@ -38,6 +40,7 @@ export class Result extends Entity<string> {
this.fastestLap = props.fastestLap;
this.incidents = props.incidents;
this.startPosition = props.startPosition;
this.points = props.points;
}
/**
@@ -51,6 +54,7 @@ export class Result extends Entity<string> {
fastestLap: number;
incidents: number;
startPosition: number;
points: number;
}): Result {
this.validate(props);
@@ -69,6 +73,7 @@ export class Result extends Entity<string> {
fastestLap,
incidents,
startPosition,
points: props.points,
});
}
@@ -80,6 +85,7 @@ export class Result extends Entity<string> {
fastestLap: number;
incidents: number;
startPosition: number;
points: number;
}): Result {
if (!props.id || props.id.trim().length === 0) {
throw new RacingDomainValidationError('Result ID is required');
@@ -93,6 +99,7 @@ export class Result extends Entity<string> {
fastestLap: LapTime.create(props.fastestLap),
incidents: IncidentCount.create(props.incidents),
startPosition: Position.create(props.startPosition),
points: props.points,
});
}