34 lines
1007 B
TypeScript
34 lines
1007 B
TypeScript
import { ValueObject } from '../../../../shared/domain/ValueObject';
|
|
import { IHttpResponse } from '../../../../core/interfaces';
|
|
|
|
interface EvidenceProps {
|
|
screenshotPath?: string;
|
|
domSnapshotPath?: string;
|
|
httpLog?: IHttpResponse[];
|
|
rawErrors?: string[];
|
|
}
|
|
|
|
export class Evidence extends ValueObject<EvidenceProps> {
|
|
static create(props: EvidenceProps): Evidence {
|
|
return new Evidence(props);
|
|
}
|
|
|
|
static empty(): Evidence {
|
|
return new Evidence({});
|
|
}
|
|
|
|
get screenshotPath(): string | undefined { return this.props.screenshotPath; }
|
|
get domSnapshotPath(): string | undefined { return this.props.domSnapshotPath; }
|
|
get httpLog(): IHttpResponse[] { return this.props.httpLog ?? []; }
|
|
get rawErrors(): string[] { return this.props.rawErrors ?? []; }
|
|
|
|
toJSON(): EvidenceProps {
|
|
return {
|
|
screenshotPath: this.props.screenshotPath,
|
|
domSnapshotPath: this.props.domSnapshotPath,
|
|
httpLog: this.props.httpLog,
|
|
rawErrors: this.props.rawErrors,
|
|
};
|
|
}
|
|
}
|