Skip to content

Commit c4232c3

Browse files
authored
tests: add value to wizard tester (#3048)
1 parent 6a8ad2f commit c4232c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/test/shared/wizards/wizardTestUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { Wizard } from '../../../shared/wizards/wizard'
1010
import { WizardForm } from '../../../shared/wizards/wizardForm'
1111

1212
interface MockWizardFormElement<TProp> {
13+
readonly value: TProp | undefined
14+
1315
applyInput(input: TProp): void
1416
clearInput(): void
1517
/**
@@ -37,6 +39,7 @@ type MockForm<T, TState = T> = {
3739
}
3840

3941
type FormTesterMethodKey = keyof MockWizardFormElement<any>
42+
const VALUE: FormTesterMethodKey = 'value'
4043
const APPLY_INPUT: FormTesterMethodKey = 'applyInput'
4144
const CLEAR_INPUT: FormTesterMethodKey = 'clearInput'
4245
const ASSERT_SHOW: FormTesterMethodKey = 'assertShow'
@@ -124,6 +127,8 @@ export function createWizardTester<T extends Partial<T>>(wizard: Wizard<T> | Wiz
124127

125128
// Using a switch rather than a map since a generic index signature is not yet possible
126129
switch (prop) {
130+
case VALUE:
131+
return _.get(form.applyDefaults(state), path)
127132
case APPLY_INPUT:
128133
return <TProp>(input: TProp) => _.set(state, path, input)
129134
case CLEAR_INPUT:

0 commit comments

Comments
 (0)