Skip to content

Commit aa9ca47

Browse files
committed
test(github): exercise the isSet guard instead of short-circuiting past it
1 parent 5558f6f commit aa9ca47

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

apps/sim/blocks/blocks/github.param-wiring.test.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,27 @@ describe('guarded assignment protects the agent tool-calling path', () => {
6868
expect(map({ operation: 'github_create_milestone' })).toEqual({})
6969
})
7070

71-
it.each(RENAMES)('never writes %s target as undefined', (_s, paramName) => {
72-
expect(map({ operation: 'x' })).not.toHaveProperty(paramName)
73-
})
71+
/**
72+
* Exercised with the alias's OWN operation, so the operation guard passes and
73+
* `isSet` is the only thing standing between an absent source field and an
74+
* `undefined` written over the model's argument. An unmatched operation would
75+
* short-circuit earlier and assert nothing about this.
76+
*/
77+
it.each(RENAMES)(
78+
'never writes %s target as undefined on its own operation',
79+
(subBlockId, paramName, toolId) => {
80+
expect(map({ operation: toolId, [subBlockId]: undefined })).not.toHaveProperty(paramName)
81+
}
82+
)
83+
84+
it.each(RENAMES)(
85+
'leaves a model-supplied %s intact when the block field is empty',
86+
(subBlockId, paramName, toolId) => {
87+
const modelArgs = { [paramName]: 'from-the-model' }
88+
const inputs = { operation: toolId, [subBlockId]: '', ...modelArgs }
89+
expect({ ...inputs, ...map(inputs) }[paramName]).toBe('from-the-model')
90+
}
91+
)
7492

7593
it('leaves a model-supplied value untouched when the block field is absent', () => {
7694
const modelArgs = {

0 commit comments

Comments
 (0)