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:
@@ -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",
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user