import { AsyncCommand } from 'fast-check' import { expectEqualResults } from '../../../chai/expectEqualResults' import { stringify } from '../../JSON' // eslint-disable-next-line @typescript-eslint/ban-types export abstract class GenericCommand implements AsyncCommand { async run(model: Model, real: Real) { await this.expectEqualResults(this.runModel(model), this.runReal(real)) } async expectEqualResults(modelTxPromise: Promise, realTxPromise: Promise) { return expectEqualResults('Model', 'Real')(modelTxPromise, realTxPromise) } abstract check(model: Readonly): Promise abstract runModel(model: Model): Promise abstract runReal(real: Real): Promise toString(): string { return `${this.constructor.name} ${(stringify(this))}` } }