MINIMAL TEST DATA BUILDERS
Philosophy: Only create what you're testing
Benefits:
- Clear intent (builder name matches test purpose)
- Fast execution (no unnecessary fields/data)
- Reusable (consistent patterns across tests)
- Maintainable (change in one place)
Static Methods
static minimal() |
|---|
Absolute minimum: single field with default config Use when testing framework basics, not specific properties |
Presentationstatic minimal(fieldType: "input" | "select" | "checkbox" | "textarea" | "datepicker" | "slider" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean | null; }; };
|
Parameters| Name | Type | Description |
|---|
| fieldType | "input" | "select" | "checkbox" | "textarea" | "datepicker" | "slider" | |
Returns{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean | null; }; } |
static withAppearance() |
|---|
Single field with Material appearance Use when testing Material-specific styling |
Presentationstatic withAppearance(appearance: "fill" | "outline"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| appearance | "fill" | "outline" | |
Returns |
static withCheckbox() |
|---|
Single checkbox Use when testing checkbox rendering |
Presentation |
Returns |
static withCheckboxColor() |
|---|
Multi-checkbox with color Use when testing Material color theme |
Presentationstatic withCheckboxColor(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
|
Parameters| Name | Type | Description |
|---|
| color | "primary" | "accent" | "warn" | |
Returns |
static withCheckboxColorSingle() |
|---|
Checkbox with color Use when testing Material color theme |
Presentationstatic withCheckboxColorSingle(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
|
Parameters| Name | Type | Description |
|---|
| color | "primary" | "accent" | "warn" | |
Returns |
static withCheckboxLabelPosition() |
|---|
Multi-checkbox with label position Use when testing checkbox label positioning |
Presentationstatic withCheckboxLabelPosition(labelPosition: "before" | "after"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
|
Parameters| Name | Type | Description |
|---|
| labelPosition | "before" | "after" | |
Returns |
static withCheckboxLabelPositionSingle() |
|---|
Checkbox with label position Use when testing checkbox label positioning |
Presentationstatic withCheckboxLabelPositionSingle(labelPosition: "before" | "after"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
|
Parameters| Name | Type | Description |
|---|
| labelPosition | "before" | "after" | |
Returns |
static withCheckboxOptions() |
|---|
Single multi-checkbox with options Use when testing checkbox group rendering |
Presentation |
ParametersReturns |
static withClassName() |
|---|
Single field with custom CSS class Use when testing custom styling |
Presentationstatic withClassName(className: string, fieldType: "input" | "textarea" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| className | string | | | fieldType | "input" | "textarea" | |
Returns |
static withCols() |
|---|
Single textarea with cols attribute Use when testing textarea columns configuration |
Presentationstatic withCols(cols: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| cols | number | |
Returns |
static withDisabled() |
|---|
Single field with disabled state Use when testing disabled behavior |
Presentationstatic withDisabled(disabled: boolean = true): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| disabled | boolean | |
Returns |
static withDisabledCheckboxOption() |
|---|
Multi-checkbox with disabled option Use when testing disabled option state |
Presentationstatic withDisabledCheckboxOption(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
|
Returns |
static withDisabledOption() |
|---|
Single select with disabled option Use when testing option disabled state |
Presentationstatic withDisabledOption(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; };
|
Returns |
static withHint() |
|---|
Single field with hint text Use when testing hint/help text rendering |
Presentationstatic withHint(hint: string): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| hint | string | |
Returns |
static |
|---|
Single input field with specific type attribute Use when testing input type rendering (email, password, number, etc.) |
Presentationstatic withInputType(type: "number" | "text" | "email" | "password" | "tel" | "url"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| type | "number" | "text" | "email" | "password" | "tel" | "url" | |
Returns |
static withLabel() |
|---|
Single field with label Use when testing label rendering |
Presentationstatic withLabel(label: string, fieldType: "input" | "select" | "checkbox" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean | null; }; };
|
Parameters| Name | Type | Description |
|---|
| label | string | | | fieldType | "input" | "select" | "checkbox" | |
Returns{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean | null; }; } |
static withMaxLength() |
|---|
Single textarea with maxLength attribute Use when testing maxlength validation |
Presentationstatic withMaxLength(maxLength: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| maxLength | number | |
Returns |
static withMultipleFields() |
|---|
Multiple fields of same type Use when testing multiple field rendering or interaction |
Presentationstatic withMultipleFields(count: number, fieldType: "input" | "select" | "checkbox" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: Record<string, string | number | boolean | null>; };
|
Parameters| Name | Type | Description |
|---|
| count | number | | | fieldType | "input" | "select" | "checkbox" | |
Returns{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: Record<string, string | number | boolean | null>; } |
static withMultiSelect() |
|---|
Single multi-select Use when testing multiple selection |
Presentationstatic withMultiSelect(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
|
Returns |
static withPlaceholder() |
|---|
Single field with placeholder Use when testing placeholder attribute |
Presentationstatic withPlaceholder(placeholder: string, fieldType: "input" | "textarea" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| placeholder | string | | | fieldType | "input" | "textarea" | |
Returns |
static withRadioColor() |
|---|
Radio group with color Use when testing Material color theme |
Presentationstatic withRadioColor(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; };
|
Parameters| Name | Type | Description |
|---|
| color | "primary" | "accent" | "warn" | |
Returns |
static withRadioLabelPosition() |
|---|
Radio group with label position Use when testing radio label positioning |
Presentationstatic withRadioLabelPosition(labelPosition: "before" | "after"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; };
|
Parameters| Name | Type | Description |
|---|
| labelPosition | "before" | "after" | |
Returns |
static withRadioOptions() |
|---|
Single radio group with options Use when testing radio group rendering |
Presentation |
ParametersReturns |
static withRequired() |
|---|
Single field marked as required Use when testing required validation |
Presentationstatic withRequired(required: boolean = true, fieldType: "input" | "textarea" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| required | boolean | | | fieldType | "input" | "textarea" | |
Returns |
static withResize() |
|---|
Single textarea with resize style Use when testing textarea resize behavior |
Presentationstatic withResize(resize: "none" | "both" | "horizontal" | "vertical"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| resize | "none" | "both" | "horizontal" | "vertical" | |
Returns |
static withRows() |
|---|
Single textarea with rows attribute Use when testing textarea rows configuration |
Presentationstatic withRows(rows: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| rows | number | |
Returns |
static withSelectOptions() |
|---|
Single select with simple options Use when testing basic select rendering |
Presentation |
ParametersReturns |
static withSliderColor() |
|---|
Slider with color Use when testing Material color theme |
Presentationstatic withSliderColor(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
|
Parameters| Name | Type | Description |
|---|
| color | "primary" | "accent" | "warn" | |
Returns |
static withSliderRange() |
|---|
Single slider with min/max Use when testing slider range |
Presentationstatic withSliderRange(min: number, max: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
|
Parameters| Name | Type | Description |
|---|
| min | number | | | max | number | |
Returns |
static withSliderStep() |
|---|
Slider with step value Use when testing slider steps |
Presentationstatic withSliderStep(step: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
|
Parameters| Name | Type | Description |
|---|
| step | number | |
Returns |
static withSliderThumbLabel() |
|---|
Slider with thumb label Use when testing thumb label display |
Presentationstatic withSliderThumbLabel(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
|
Returns |
static withSliderTickMarks() |
|---|
Slider with tick marks Use when testing tick mark display |
Presentationstatic withSliderTickMarks(tickInterval: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
|
Parameters| Name | Type | Description |
|---|
| tickInterval | number | |
Returns |
static withTabIndex() |
|---|
Single field with tabIndex Use when testing tab order |
Presentationstatic withTabIndex(tabIndex: number, fieldType: "input" | "textarea" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
|
Parameters| Name | Type | Description |
|---|
| tabIndex | number | | | fieldType | "input" | "textarea" | |
Returns |
static withToggle() |
|---|
Single toggle Use when testing toggle rendering |
Presentation |
Returns |
static withToggleColor() |
|---|
Toggle with color Use when testing Material color theme |
Presentationstatic withToggleColor(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
|
Parameters| Name | Type | Description |
|---|
| color | "primary" | "accent" | "warn" | |
Returns |
static withToggleLabelPosition() |
|---|
Toggle with label position Use when testing toggle label positioning |
Presentationstatic withToggleLabelPosition(labelPosition: "before" | "after"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
|
Parameters| Name | Type | Description |
|---|
| labelPosition | "before" | "after" | |
Returns |
static withValue() |
|---|
Single field with initial value Use when testing value binding and updates |
Presentationstatic withValue(value: string | number | boolean): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean; }; };
|
Parameters| Name | Type | Description |
|---|
| value | string | number | boolean | |
Returns |