mirror of
https://github.com/actions/github-script.git
synced 2026-04-07 22:50:04 +00:00
Add docs and tests for getOctokit script context
This commit is contained in:
parent
a7dc0e4fc1
commit
cc685dce52
3 changed files with 24 additions and 0 deletions
|
|
@ -8,6 +8,18 @@ describe('callAsyncFunction', () => {
|
|||
expect(result).toEqual('bar')
|
||||
})
|
||||
|
||||
test('passes getOctokit through the script context', async () => {
|
||||
const getOctokit = jest.fn().mockReturnValue('secondary-client')
|
||||
|
||||
const result = await callAsyncFunction(
|
||||
{getOctokit} as any,
|
||||
"return getOctokit('token')"
|
||||
)
|
||||
|
||||
expect(getOctokit).toHaveBeenCalledWith('token')
|
||||
expect(result).toEqual('secondary-client')
|
||||
})
|
||||
|
||||
test('throws on ReferenceError', async () => {
|
||||
expect.assertions(1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue