added bailed out test too short validation

This commit is contained in:
Miodec 2022-09-17 22:18:50 +02:00
parent f6c10e656b
commit 8a78e2b462

View file

@ -56,18 +56,24 @@ export function isTagPresetNameValid(name: string): boolean {
}
export function isTestTooShort(result: MonkeyTypes.CompletedEvent): boolean {
const { mode, mode2, customText, testDuration } = result;
const { mode, mode2, customText, testDuration, bailedOut } = result;
if (mode === "time") {
const setTimeTooShort = mode2 > 0 && mode2 < 15;
const infiniteTimeTooShort = mode2 === 0 && testDuration < 15;
return setTimeTooShort || infiniteTimeTooShort;
const bailedOutTooShort = bailedOut
? bailedOut && testDuration < 15
: false;
return setTimeTooShort || infiniteTimeTooShort || bailedOutTooShort;
}
if (mode === "words") {
const setWordTooShort = mode2 > 0 && mode2 < 10;
const infiniteWordTooShort = mode2 === 0 && testDuration < 15;
return setWordTooShort || infiniteWordTooShort;
const bailedOutTooShort = bailedOut
? bailedOut && testDuration < 15
: false;
return setWordTooShort || infiniteWordTooShort || bailedOutTooShort;
}
if (mode === "custom") {
@ -77,7 +83,15 @@ export function isTestTooShort(result: MonkeyTypes.CompletedEvent): boolean {
!isWordRandom && !isTimeRandom && _.isNumber(textLen) && textLen < 10;
const randomWordsTooShort = isWordRandom && !isTimeRandom && word < 10;
const randomTimeTooShort = !isWordRandom && isTimeRandom && time < 15;
return setTextTooShort || randomWordsTooShort || randomTimeTooShort;
const bailedOutTooShort = bailedOut
? bailedOut && testDuration < 15
: false;
return (
setTextTooShort ||
randomWordsTooShort ||
randomTimeTooShort ||
bailedOutTooShort
);
}
if (mode === "zen") {