23 lines
813 B
JavaScript
23 lines
813 B
JavaScript
import { BaseGameValidator } from "../../../../shared/BaseGameValidator";
|
|
|
|
export class Exemplo2Validator extends BaseGameValidator {
|
|
validatePhase(history, config, gameConfig, sceneRef) {
|
|
const esperado = config?.textoEsperado || "SOBERANIA DIGITAL";
|
|
const atual = sceneRef?.textoAtual ?? "";
|
|
|
|
if (atual === esperado) return this.success();
|
|
|
|
const msgErro =
|
|
atual && typeof gameConfig?.mensagens?.textoErrado === "function"
|
|
? gameConfig.mensagens.textoErrado(atual, esperado)
|
|
: `Texto incorreto: "${atual}". O esperado é "${esperado}".`;
|
|
|
|
return this.failure(msgErro);
|
|
}
|
|
}
|
|
|
|
export function validationSolution(history, config, gameConfig, sceneRef) {
|
|
const validator = new Exemplo2Validator();
|
|
return validator.validate(history, config, gameConfig, sceneRef);
|
|
}
|