test: validate non-string file paths in parseFileTemplateVariables

Add test cases to verify that `parseFileTemplateVariables` correctly
throws an error when a non-string value (e.g. number, boolean, object)
is provided as a file path in the input YAML. This ensures the existing
validation is properly tested.

Co-authored-by: Pet3cy <169947521+Pet3cy@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot]
2026-02-25 04:12:17 +00:00
parent a380166897
commit a2600c61b7
+12
View File
@@ -135,5 +135,17 @@ describe('prompt.ts', () => {
it('errors on missing files', () => {
expect(() => parseFileTemplateVariables('x: ./does-not-exist.txt')).toThrow('was not found')
})
it('errors on non-string file paths', () => {
expect(() => parseFileTemplateVariables('x: 123')).toThrow(
"File template variable 'x' must be a string file path",
)
expect(() => parseFileTemplateVariables('x: true')).toThrow(
"File template variable 'x' must be a string file path",
)
expect(() => parseFileTemplateVariables('x: { nested: "object" }')).toThrow(
"File template variable 'x' must be a string file path",
)
})
})
})