24 lines
1.0 KiB
JavaScript
24 lines
1.0 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ComparisonStatus = void 0;
|
|
const ValueObject_1 = require("../../../../shared/domain/ValueObject");
|
|
class ComparisonStatus extends ValueObject_1.ValueObject {
|
|
get value() {
|
|
return this.props.value;
|
|
}
|
|
static passed() { return new ComparisonStatus({ value: 'passed' }); }
|
|
static failed() { return new ComparisonStatus({ value: 'failed' }); }
|
|
static newState() { return new ComparisonStatus({ value: 'new_state' }); }
|
|
static pending() { return new ComparisonStatus({ value: 'pending' }); }
|
|
static from(value) {
|
|
if (!['passed', 'failed', 'new_state', 'pending'].includes(value)) {
|
|
throw new Error(`Invalid comparison status: ${value}`);
|
|
}
|
|
return new ComparisonStatus({ value: value });
|
|
}
|
|
isPassed() { return this.props.value === 'passed'; }
|
|
isFailed() { return this.props.value === 'failed'; }
|
|
isNewState() { return this.props.value === 'new_state'; }
|
|
}
|
|
exports.ComparisonStatus = ComparisonStatus;
|