Skip to content

Commit f12a4b0

Browse files
refine payload generator
1 parent e6aca42 commit f12a4b0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/cli/src/commands/generate-test-payload.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ export default class GenerateTestPayload extends Command {
177177
for (const [fieldKey, field] of Object.entries(fields)) {
178178
if (field.default) {
179179
mapping[fieldKey] = field.default
180+
} else if (field.choices) {
181+
// if choices is array of string, pick the first one
182+
// if choices is array of {label: string, value: string}, then pick the value of the first one
183+
mapping[fieldKey] = typeof field.choices[0] === 'string' ? field.choices[0] : field.choices[0].value
180184
}
181185
}
182186

0 commit comments

Comments
 (0)