Skip to content

Commit 5558f6f

Browse files
committed
test(github): pin the gist visibility and list-filter outcomes
1 parent 4a60d17 commit 5558f6f

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,42 @@ describe('absent operation degrades to a no-op, never a clobber', () => {
243243
expect({ ...modelArgs, ...map({ ...modelArgs, ...stale }) }).toEqual(modelArgs)
244244
})
245245
})
246+
247+
/**
248+
* `milestone_state` is a LIST filter. `create_milestone` and `update_milestone`
249+
* also declare a `state` param, but no subBlock renders for them, so the value
250+
* sitting in `params` is only ever a leftover from the list operation. Aliasing
251+
* it onto those would silently set the state of a milestone being created.
252+
*/
253+
describe('a list filter never becomes a write value', () => {
254+
it.each(['github_create_milestone', 'github_update_milestone'])(
255+
'%s ignores a stale milestone_state',
256+
(operation) => {
257+
expect(map({ operation, milestone_state: 'closed' })).not.toHaveProperty('state')
258+
}
259+
)
260+
261+
it('while the list operation still receives it', () => {
262+
expect(map({ operation: 'github_list_milestones', milestone_state: 'closed' }).state).toBe(
263+
'closed'
264+
)
265+
})
266+
})
267+
268+
/**
269+
* The user-visible outcomes for gist visibility, pinned explicitly because this
270+
* is the one alias whose correction moves a gist from secret to public.
271+
*/
272+
describe('create gist visibility outcomes', () => {
273+
it('untouched leaves the tool default (secret)', () => {
274+
expect(map({ operation: 'github_create_gist' })).not.toHaveProperty('public')
275+
})
276+
277+
it('Secret stays secret', () => {
278+
expect(map({ operation: 'github_create_gist', gist_public: 'false' }).public).toBe(false)
279+
})
280+
281+
it('Public now actually creates a public gist', () => {
282+
expect(map({ operation: 'github_create_gist', gist_public: 'true' }).public).toBe(true)
283+
})
284+
})

0 commit comments

Comments
 (0)