@coorpacademy/progression-engine
Version:
21 lines (20 loc) • 766 B
JavaScript
;
exports.__esModule = true;
exports.default = validate;
var _errors = require("../errors");
function validate(config) {
return (state, action) => {
switch (action.type) {
case 'answer':
case 'extraLifeAccepted':
case 'extraLifeRefused':
{
if (state.nextContent.ref !== action.payload.content.ref || state.nextContent.type !== action.payload.content.type) {
throw (0, _errors.createStateValidationError)(`The content of the progression state does not match the ${action.type} action: state.nextContent: ${JSON.stringify(state.nextContent)} | action.payload.content: ${JSON.stringify(action.payload.content)}`);
}
break;
}
}
};
}
//# sourceMappingURL=validate.js.map