Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
407 commits
Select commit Hold shift + click to select a range
d83f335
add replay events
Miodec Jul 10, 2025
a8f8e27
remove
Miodec Jul 10, 2025
c6e3733
remove default
Miodec Jul 10, 2025
8367c55
stop if any popup is visible
Miodec Jul 11, 2025
e1ade4e
stop if not active
Miodec Jul 11, 2025
3a85184
test needs to start somehow duh
Miodec Jul 11, 2025
668957a
record keyup and keydown times
Miodec Jul 11, 2025
6bdb1ad
refactor
Miodec Jul 11, 2025
d9969d4
refactor, add comment
Miodec Jul 11, 2025
1806f3f
add zen mode finish
Miodec Jul 11, 2025
7608b35
auto indent in code language
Miodec Jul 11, 2025
9c7140e
reorder
Miodec Jul 11, 2025
183c4e1
implement code unindent on backspace
Miodec Jul 11, 2025
0aabddd
extract checks for easier debugging
Miodec Jul 11, 2025
9d3945a
replace …, œ and æ
Miodec Jul 11, 2025
5b94181
comment
Miodec Jul 11, 2025
07f8b6b
missing stop on letter check
Miodec Jul 12, 2025
bb8b93b
comment
Miodec Jul 12, 2025
83f8386
update active word before test word change
Miodec Jul 12, 2025
3130961
remove difficulty check
Miodec Jul 12, 2025
de15522
shouldinsertspacecharacter returns null if data is not space
Miodec Jul 12, 2025
c84f7b7
return increased index and last burst data out of gotonextword
Miodec Jul 12, 2025
897dde4
fix quick end not working
Miodec Jul 12, 2025
0788c1c
rename
Miodec Jul 12, 2025
53dc5e9
only update corrected on moving to next word
Miodec Jul 14, 2025
5101537
Merge branch 'master' into input-rewrite
Miodec Sep 3, 2025
1b431bd
fix merge
Miodec Sep 3, 2025
edd3223
dont emulate newline if composing
Miodec Sep 4, 2025
c5ae2df
add isSpace to detect weird spaces
Miodec Sep 4, 2025
538cac6
only add invisible letter if composition data is empty
Miodec Sep 4, 2025
a837780
if NOT composing
Miodec Sep 4, 2025
f32e2c5
only move to the end when text is selected or its not at the end
Miodec Sep 5, 2025
5d8fc23
split part 1
Miodec Sep 5, 2025
54dd593
inline
Miodec Sep 5, 2025
0123dab
merge keydown and keyup events
Miodec Sep 5, 2025
467cf5a
extract key handlers
Miodec Sep 5, 2025
53e8878
split
Miodec Sep 5, 2025
b99d32a
move debug logs to same place
Miodec Sep 5, 2025
c99c9bf
move to setup
Miodec Sep 5, 2025
dd81bab
merge emulation with input
Miodec Sep 5, 2025
827f45c
add delete, beforedelete
Miodec Sep 5, 2025
97c4821
organise
Miodec Sep 5, 2025
5ee10bc
refactor
Miodec Sep 5, 2025
6cadb86
move sanity check
Miodec Sep 5, 2025
30a76b3
remove comment
Miodec Sep 5, 2025
7de5d0a
rename
Miodec Sep 5, 2025
91caf1b
move to file
Miodec Sep 5, 2025
a84c35f
refactor
Miodec Sep 5, 2025
b14339c
useless comment
Miodec Sep 5, 2025
804ada9
debug log
Miodec Sep 5, 2025
4718f76
smaller log
Miodec Sep 5, 2025
a286fda
rename
Miodec Sep 5, 2025
9c92b5a
refactpr
Miodec Sep 5, 2025
437fd4b
overload, update active word letter only when needed
Miodec Sep 5, 2025
1b0bb8a
only update ui if not moved forward
Miodec Sep 5, 2025
c530bd1
rename
Miodec Sep 5, 2025
58cd20d
space instead of data
Miodec Sep 5, 2025
be77a2c
split into smaller functions
Miodec Sep 5, 2025
f0aec93
move fail and finish to input
Miodec Sep 5, 2025
6c4093c
this one is fine, rename funciton param
Miodec Sep 5, 2025
ddfe555
rearrange
Miodec Sep 5, 2025
c94e41b
simplify, refactor
Miodec Sep 5, 2025
dc7cd0c
use correct var, rename param, comment
Miodec Sep 5, 2025
4e8e073
comment
Miodec Sep 5, 2025
627cfa1
rearrange vars, explaining comment
Miodec Sep 5, 2025
9ed775b
update word before moving in nospace
Miodec Sep 5, 2025
34b6322
add increasedWordIndex as param to after test text input to make sure…
Miodec Sep 5, 2025
62a7ca8
missing param
Miodec Sep 5, 2025
e714a3b
comment
Miodec Sep 5, 2025
b266646
note formatting
Miodec Sep 5, 2025
a298391
formatting
Miodec Sep 5, 2025
cf34c8f
reduce repetition
Miodec Sep 5, 2025
c03b760
remove debug lines
Miodec Sep 5, 2025
8cd9543
fix space character not being inserted in expert and master
Miodec Sep 5, 2025
6e2fdc4
disable stop on error in non normal difficulty
Miodec Sep 5, 2025
15adfb6
dont call oninsertext if data is empty
Miodec Sep 5, 2025
c786862
replace space like chars with space when checking if correct
Miodec Sep 5, 2025
5e68bc6
fix multicharacter handling not checking char correctness correctly
Miodec Sep 5, 2025
ac4c9db
dont call ui when in multi mode and not on the last char
Miodec Sep 6, 2025
ed49a06
check difficulty first
Miodec Sep 6, 2025
e367cf1
switch difficulty check to full input check instead of one character
Miodec Sep 6, 2025
c87eb46
fail or finish only on the last index in multi or when in single mode
Miodec Sep 6, 2025
112d7ba
removed unnecessary params for now, add some comments
Miodec Sep 6, 2025
171854c
fix too many ui calls
Miodec Sep 6, 2025
9d70fd3
make sure to reset the state
Miodec Sep 6, 2025
43fbd76
can't fail in zen
Miodec Sep 6, 2025
315708a
reset composition state when starting
Miodec Sep 6, 2025
2a3a758
move firefox ignored event to before input
Miodec Sep 6, 2025
cd66d18
comment update
Miodec Sep 6, 2025
9b77b4e
update comment
Miodec Sep 6, 2025
14daa76
never insert space in zen
Miodec Sep 6, 2025
8d47bc1
block everything when test is restarting
Miodec Sep 6, 2025
955835b
fix stop on letter
Miodec Sep 6, 2025
5e2609a
log full event
Miodec Sep 7, 2025
c4578e3
dedicated composition ui function
Miodec Sep 7, 2025
8884267
bandaid to stop double sound on composition end
Miodec Sep 7, 2025
280d50b
fix errors
Miodec Sep 7, 2025
d02fe0a
fixed sound not working for non composition
Miodec Sep 7, 2025
2999c02
just dont call it instead
Miodec Sep 7, 2025
a591535
Merge branch 'master' into input-rewrite
Miodec Sep 8, 2025
e96a595
fix merge
Miodec Sep 8, 2025
88b631d
fix merge
Miodec Sep 8, 2025
c22aa84
fix merge
Miodec Sep 8, 2025
3ebb3d4
remove comment
Miodec Sep 8, 2025
ec7560f
move live burst update to test ui, make aftertestwordchange async
Miodec Sep 8, 2025
11c3e08
use vanilla
Miodec Sep 8, 2025
fa4cc84
fix opposite shift mode accuracy penalty (and sound) not working
Miodec Sep 8, 2025
8aa5199
Merge branch 'master' into input-rewrite
Miodec Sep 8, 2025
d3c77db
Merge branch 'master' into input-rewrite
Miodec Sep 8, 2025
0428109
add afterTestStart
Miodec Sep 9, 2025
2620f3c
move listener
Miodec Sep 10, 2025
2055956
comment handled migration
Miodec Sep 10, 2025
ef9520e
move autofocus to new system
Miodec Sep 10, 2025
282231a
move funbox handle keydown
Miodec Sep 10, 2025
3c0cace
move prevent
Miodec Sep 10, 2025
c937a8f
remove handleChar and preventdefaultevent, add getEmulatedChar, move …
Miodec Sep 10, 2025
97bcee2
always just go to previous word (first visible check is in beforedelete)
Miodec Sep 10, 2025
752ead0
Merge branch 'master' into input-rewrite
Miodec Nov 2, 2025
4cd3331
just use composition ending
Miodec Nov 3, 2025
4cd1ab0
just dont bother for now
Miodec Nov 3, 2025
dd2f527
destructure inside, make sure to pass the whole options object throug…
Miodec Nov 4, 2025
e9c467d
update test input one by one in multi mode
Miodec Nov 4, 2025
f17b83d
update active word before going to the next word if composition is en…
Miodec Nov 4, 2025
5154eca
remove console log
Miodec Nov 4, 2025
116b406
ignore if restarting
Miodec Nov 4, 2025
17fab31
offset
Miodec Nov 4, 2025
765f1c9
default true
Miodec Nov 4, 2025
eb1c0de
comments, handle multi word insertion
Miodec Nov 4, 2025
e19505f
better types, rename
Miodec Nov 4, 2025
a68dbd6
change temp styling
Miodec Nov 4, 2025
c02637c
remove all the special cases and instead just emulate on multi char i…
Miodec Nov 4, 2025
4a42718
rework emulateInsertText type
Miodec Nov 4, 2025
9565149
fix caret positioning with composition
Miodec Nov 5, 2025
efe4540
reset composition data
Miodec Nov 5, 2025
dfa9969
redundant code
Miodec Nov 5, 2025
36cdb64
quick restart from other pages
Miodec Nov 5, 2025
8fa9927
small perf optimisation
Miodec Nov 5, 2025
1d49e73
perf
Miodec Nov 5, 2025
4233d98
only run expensive check when really necessary
Miodec Nov 5, 2025
fa47ed2
perf
Miodec Nov 5, 2025
edecbef
Merge branch 'master' into input-rewrite
Miodec Nov 9, 2025
d2acdc4
remove timeouts
Miodec Nov 9, 2025
e01b03e
Merge branch 'master' into input-rewrite
Miodec Nov 18, 2025
829a4e7
comment
Miodec Nov 18, 2025
1a74573
block arrows
Miodec Nov 18, 2025
9ffea02
missing return
Miodec Nov 18, 2025
5db8760
fix code unindent on backspace
Miodec Nov 18, 2025
a928307
comment
Miodec Nov 18, 2025
6e61f2a
comment out
Miodec Nov 18, 2025
e7e7ac0
add composition display element
Miodec Nov 18, 2025
7ae4f7f
remove comments
Miodec Nov 18, 2025
ed76f4a
rename
Miodec Nov 18, 2025
3ffdb43
refactor
Miodec Nov 18, 2025
18705c1
remove
Miodec Nov 18, 2025
991abd5
yeet
Miodec Nov 18, 2025
ffff728
rename
Miodec Nov 18, 2025
99c2aad
rename
Miodec Nov 18, 2025
a868f7a
fix opposite shift and stop on letter stacking
Miodec Nov 18, 2025
c47cf45
handle opposite shift before emulation
Miodec Nov 18, 2025
d155ae4
incorrect code unindent on backspace behavior
Miodec Nov 18, 2025
35d2720
reorder things
Miodec Nov 19, 2025
7e6f5d5
move call to ui
Miodec Nov 19, 2025
2c548ef
return, dont assign
Miodec Nov 19, 2025
d1d35aa
fix comment
Miodec Nov 19, 2025
11e8716
fix keyup keydown timing tracking
Miodec Nov 19, 2025
45624a6
Merge branch 'master' into input-rewrite
Miodec Nov 19, 2025
3bffeb7
duplicate listener
Miodec Nov 19, 2025
2251706
rename
Miodec Nov 19, 2025
fa10f4f
rename
Miodec Nov 19, 2025
0ee73bd
remove comments
Miodec Nov 19, 2025
ee927a9
update comments
Miodec Nov 19, 2025
2f0feff
comment
Miodec Nov 19, 2025
f91722c
small comment
Miodec Nov 19, 2025
5bf456d
return
Miodec Nov 19, 2025
349ced8
extract for easier understanding
Miodec Nov 19, 2025
6700753
comment
Miodec Nov 19, 2025
3ff83a5
move jump check to the end
Miodec Nov 19, 2025
a85aedf
remove comment
Miodec Nov 19, 2025
0742562
unnecessary call
Miodec Nov 20, 2025
4590e43
extract
Miodec Nov 20, 2025
911f308
blind mode check
Miodec Nov 20, 2025
1fb5b3d
extract to const
Miodec Nov 20, 2025
5c2608f
yeet
Miodec Nov 20, 2025
0ab16b2
remove unused code
Miodec Nov 20, 2025
2cc5a0e
jsdoc
Miodec Nov 20, 2025
c0c8dd0
unnecessary param
Miodec Nov 20, 2025
8c5c1f9
fully remove multiindex, simplify type
Miodec Nov 20, 2025
36aad53
optional instead
Miodec Nov 20, 2025
e653262
fix charoverride
Miodec Nov 20, 2025
c25abe7
reduce duplication
Miodec Nov 21, 2025
134903d
early return
Miodec Nov 21, 2025
8403293
rework validation and fail/finish check
Miodec Nov 22, 2025
de0b784
missing comment
Miodec Nov 22, 2025
5361847
fix tests
Miodec Nov 22, 2025
95b5294
use options object
Miodec Nov 22, 2025
6c7507c
tests
Miodec Nov 22, 2025
1f3b8c6
update
Miodec Nov 22, 2025
0950a83
rename
Miodec Nov 22, 2025
f56fc69
change param
Miodec Nov 22, 2025
6426f53
update tests
Miodec Nov 22, 2025
2429fb7
tests
Miodec Nov 22, 2025
9bf54bc
remove test styles
Miodec Nov 22, 2025
e5054f1
rename
Miodec Nov 22, 2025
252edbe
remove dependency in fail or finish, pass as param instead
Miodec Nov 22, 2025
fa4dbce
ooga booga
Miodec Nov 22, 2025
decc065
short circuit
Miodec Nov 22, 2025
0037948
cleaner
Miodec Nov 22, 2025
bc0cbab
rename
Miodec Nov 22, 2025
7bb2652
throw if not found
Miodec Nov 22, 2025
87393a1
update newline handling
Miodec Nov 22, 2025
3c79db8
move the job of syncing to dom outside the input element module
Miodec Nov 22, 2025
c044b13
throw on unhandled event
Miodec Nov 22, 2025
626648a
use textarea
Miodec Nov 22, 2025
6b5b192
fix checks
Miodec Nov 22, 2025
fc848de
unnecessary type
Miodec Nov 22, 2025
326689f
remove style
Miodec Nov 22, 2025
73fb0ad
add isFocused function
Miodec Nov 22, 2025
6dc5ec4
Merge branch 'master' into input-rewrite
Miodec Nov 22, 2025
5a445d0
rename
Miodec Nov 22, 2025
655e325
rename
Miodec Nov 22, 2025
fc9585f
use input element functions
Miodec Nov 22, 2025
38df52c
use functions
Miodec Nov 22, 2025
c01824a
unnecessary focus
Miodec Nov 22, 2025
6bc321c
rename
Miodec Nov 22, 2025
e734e67
unnecessary const
Miodec Nov 22, 2025
50ac8e5
unnecessary reassignment
Miodec Nov 22, 2025
3d01202
jsdoc
Miodec Nov 22, 2025
578d474
unnecessary check
Miodec Nov 22, 2025
8ef5910
move checks
Miodec Nov 22, 2025
5d4e1f0
cleanup
Miodec Nov 22, 2025
4754cdf
rename
Miodec Nov 22, 2025
f30d915
rename file
Miodec Nov 22, 2025
9bd249a
experiment
Miodec Nov 22, 2025
d132a76
experiment part deux
Miodec Nov 22, 2025
839cb16
move
Miodec Nov 22, 2025
e5f9530
reorder
Miodec Nov 22, 2025
b11c33a
merge
Miodec Nov 22, 2025
72e4e0e
remove
Miodec Nov 22, 2025
2251c10
reorder
Miodec Nov 22, 2025
ef9a76f
restructure, comments
Miodec Nov 22, 2025
2c18b96
extract funbox handle
Miodec Nov 22, 2025
0129122
fix corrected being wrong
Miodec Nov 23, 2025
a33f3c5
irrelevant test
Miodec Nov 23, 2025
3a4c695
append wordsinput for tests
Miodec Nov 23, 2025
c31b35b
move character equivallence check to insert-text handler, replace the…
Miodec Nov 23, 2025
5b12b35
push to history before adding word
Miodec Nov 23, 2025
9fedab2
remove word in zen mode
Miodec Nov 23, 2025
d9951dc
fix zen mode not auto jumping on word wrap
Miodec Nov 23, 2025
639d533
use sets instead of maps
Miodec Nov 23, 2025
a78c659
jsdoc
Miodec Nov 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
365 changes: 365 additions & 0 deletions frontend/__tests__/input/helpers/fail-or-finish.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,365 @@
import { describe, it, expect, vi, beforeEach, afterAll } from "vitest";
import {
checkIfFailedDueToMinBurst,
checkIfFailedDueToDifficulty,
checkIfFinished,
} from "../../../src/ts/input/helpers/fail-or-finish";
import { __testing } from "../../../src/ts/config";
import * as Misc from "../../../src/ts/utils/misc";
import * as TestLogic from "../../../src/ts/test/test-logic";
import * as Strings from "../../../src/ts/utils/strings";

const { replaceConfig } = __testing;

vi.mock("../../../src/ts/utils/misc", async (importOriginal) => {
const actual = await importOriginal<
typeof import("../../../src/ts/utils/misc")
>();
return {
...actual,
whorf: vi.fn(),
};
});

vi.mock("../../../src/ts/test/test-logic", () => ({
areAllTestWordsGenerated: vi.fn(),
}));

vi.mock("../../../src/ts/utils/strings", () => ({
isSpace: vi.fn(),
}));

describe("checkIfFailedDueToMinBurst", () => {
beforeEach(() => {
vi.clearAllMocks();
replaceConfig({
minBurst: "off",
mode: "time",
minBurstCustomSpeed: 100,
});
(Misc.whorf as any).mockReturnValue(0);
(TestLogic.areAllTestWordsGenerated as any).mockReturnValue(true);
});

afterAll(() => {
replaceConfig({});
});

it.each([
{
desc: "returns false if minBurst is off",
config: { minBurst: "off" },
lastBurst: 50,
expected: false,
},
{
desc: "returns false if lastBurst is null",
config: { minBurst: "fixed" },
lastBurst: null,
expected: false,
},
{
desc: "returns true if fixed burst is too slow",
config: { minBurst: "fixed", minBurstCustomSpeed: 100 },
lastBurst: 99,
expected: true,
},
{
desc: "returns false if fixed burst is fast enough",
config: { minBurst: "fixed", minBurstCustomSpeed: 100 },
lastBurst: 100,
expected: false,
},
{
desc: "returns true if flex burst is too slow",
config: { minBurst: "flex", minBurstCustomSpeed: 100 },
lastBurst: 49,
whorfRet: 50,
expected: true,
},
{
desc: "returns false if flex burst is fast enough",
config: { minBurst: "flex", minBurstCustomSpeed: 100 },
lastBurst: 50,
whorfRet: 50,
expected: false,
},
])("$desc", ({ config, lastBurst, whorfRet, expected }) => {
replaceConfig(config as any);
if (whorfRet !== undefined) {
(Misc.whorf as any).mockReturnValue(whorfRet);
}

const result = checkIfFailedDueToMinBurst({
testInputWithData: "test",
currentWord: "test",
lastBurst,
});

expect(result).toBe(expected);
});

it("uses correct length for whorf calculation in zen mode", () => {
replaceConfig({ minBurst: "flex", mode: "zen", minBurstCustomSpeed: 100 });
checkIfFailedDueToMinBurst({
testInputWithData: "zeninput",
currentWord: "ignored",
lastBurst: 50,
});
expect(Misc.whorf).toHaveBeenCalledWith(100, 8);
});

it("uses correct length for whorf calculation in normal mode", () => {
replaceConfig({ minBurst: "flex", mode: "time", minBurstCustomSpeed: 100 });
checkIfFailedDueToMinBurst({
testInputWithData: "input",
currentWord: "target",
lastBurst: 50,
});
expect(Misc.whorf).toHaveBeenCalledWith(100, 6);
});
});

describe("checkIfFailedDueToDifficulty", () => {
beforeEach(() => {
replaceConfig({
mode: "time",
difficulty: "normal",
});
});

afterAll(() => {
replaceConfig({});
});

it.each([
{
desc: "zen mode, master - never fails",
config: { mode: "zen", difficulty: "master" },
correct: false,
spaceOrNewline: true,
input: "hello",
expected: false,
},
{
desc: "zen mode - never fails",
config: { mode: "zen", difficulty: "normal" },
correct: false,
spaceOrNewline: true,
input: "hello",
expected: false,
},
//
{
desc: "normal typing incorrect- never fails",
config: { difficulty: "normal" },
correct: false,
spaceOrNewline: false,
input: "hello",
expected: false,
},
{
desc: "normal typing space incorrect - never fails",
config: { difficulty: "normal" },
correct: false,
spaceOrNewline: true,
input: "hello",
expected: false,
},
{
desc: "normal typing correct - never fails",
config: { difficulty: "normal" },
correct: true,
spaceOrNewline: false,
input: "hello",
expected: false,
},
{
desc: "normal typing space correct - never fails",
config: { difficulty: "normal" },
correct: true,
spaceOrNewline: true,
input: "hello",
expected: false,
},
//
{
desc: "expert - fail if incorrect space",
config: { difficulty: "expert" },
correct: false,
spaceOrNewline: true,
input: "he",
expected: true,
},
{
desc: "expert - dont fail if space is the first character",
config: { difficulty: "expert" },
correct: false,
spaceOrNewline: true,
input: " ",
expected: false,
},
{
desc: "expert: - dont fail if just typing",
config: { difficulty: "expert" },
correct: false,
spaceOrNewline: false,
input: "h",
expected: false,
},
{
desc: "expert: - dont fail if just typing",
config: { difficulty: "expert" },
correct: true,
spaceOrNewline: false,
input: "h",
expected: false,
},
//
{
desc: "master - fail if incorrect char",
config: { difficulty: "master" },
correct: false,
spaceOrNewline: false,
input: "h",
expected: true,
},
{
desc: "master - fail if incorrect first space",
config: { difficulty: "master" },
correct: true,
spaceOrNewline: true,
input: " ",
expected: false,
},
{
desc: "master - dont fail if correct char",
config: { difficulty: "master" },
correct: true,
spaceOrNewline: false,
input: "a",
expected: false,
},
{
desc: "master - dont fail if correct space",
config: { difficulty: "master" },
correct: true,
spaceOrNewline: true,
input: " ",
expected: false,
},
])("$desc", ({ config, correct, spaceOrNewline, input, expected }) => {
replaceConfig(config as any);
const result = checkIfFailedDueToDifficulty({
testInputWithData: input,
correct,
spaceOrNewline,
});
expect(result).toBe(expected);
});
});

describe("checkIfFinished", () => {
beforeEach(() => {
vi.clearAllMocks();
replaceConfig({
quickEnd: false,
stopOnError: "off",
});
(Strings.isSpace as any).mockReturnValue(false);
(TestLogic.areAllTestWordsGenerated as any).mockReturnValue(true);
});

afterAll(() => {
replaceConfig({});
});

it.each([
{
desc: "false if not all words typed",
allWordsTyped: false,
testInputWithData: "word",
currentWord: "word",
expected: false,
},
{
desc: "false if not all words generated, but on the last word",
allWordsGenerated: false,
allWordsTyped: true,
testInputWithData: "word",
currentWord: "word",
expected: false,
},
{
desc: "true if last word is correct",
allWordsTyped: true,
testInputWithData: "word",
currentWord: "word",
expected: true,
},
{
desc: "true if quickEnd enabled and lengths match",
allWordsTyped: true,
testInputWithData: "asdf",
currentWord: "word",
config: { quickEnd: true },
expected: true,
},
{
desc: "false if quickEnd disabled and lengths match",
allWordsTyped: true,
testInputWithData: "asdf",
currentWord: "word",
config: { quickEnd: false },
expected: false,
},
{
desc: "true if space on the last word",
allWordsTyped: true,
testInputWithData: "wo ",
currentWord: "word",
shouldGoToNextWord: true,
expected: true,
},
{
desc: "false if still typing, quickend disabled",
allWordsTyped: true,
testInputWithData: "wordwordword",
currentWord: "word",
expected: false,
},
] as {
desc: string;
allWordsTyped: boolean;
allWordsGenerated?: boolean;
shouldGoToNextWord: boolean;
testInputWithData: string;
currentWord: string;
config?: Record<string, any>;
isSpace?: boolean;
expected: boolean;
}[])(
"$desc",
({
allWordsTyped,
allWordsGenerated,
shouldGoToNextWord,
testInputWithData,
currentWord,
config,
expected,
}) => {
if (config) replaceConfig(config as any);

const result = checkIfFinished({
shouldGoToNextWord,
testInputWithData,
currentWord,
allWordsTyped,
allWordsGenerated: allWordsGenerated ?? true,
});

expect(result).toBe(expected);
}
);
});
Loading