test that one invalid iteration blocks the entire iterated action and identifies the offending key

Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
Matt Benson
2023-10-23 20:25:45 -05:00
parent 8acc167dfc
commit 5696c46d0b
@@ -674,6 +674,34 @@ describe('DefaultWorkflowRunner', () => {
);
}
});
it('should validate each action iteration', async () => {
const task = createMockTaskWithSpec({
apiVersion: 'scaffolder.backstage.io/v1beta3',
steps: [
{
id: 'test',
name: 'name',
each: '${{parameters.data}}',
action: 'jest-validated-action',
input: { foo: '${{each.value.foo}}' },
},
],
output: {},
parameters: {
data: [
{
foo: 0,
},
{},
],
},
});
await expect(runner.execute(task)).rejects.toThrow(
'Invalid input passed to action jest-validated-action[1], instance requires property "foo"',
);
expect(fakeActionHandler).not.toHaveBeenCalled();
});
});
describe('secrets', () => {