Convert action to TypeScript
This commit is contained in:
10
__fixtures__/@actions/core.ts
Normal file
10
__fixtures__/@actions/core.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type * as core from '@actions/core'
|
||||
import { jest } from '@jest/globals'
|
||||
|
||||
export const debug = jest.fn<typeof core.debug>()
|
||||
export const error = jest.fn<typeof core.error>()
|
||||
export const info = jest.fn<typeof core.info>()
|
||||
export const getInput = jest.fn<typeof core.getInput>()
|
||||
export const setOutput = jest.fn<typeof core.setOutput>()
|
||||
export const setFailed = jest.fn<typeof core.setFailed>()
|
||||
export const warning = jest.fn<typeof core.warning>()
|
||||
27
__fixtures__/@actions/github.ts
Normal file
27
__fixtures__/@actions/github.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as octokit from '../@octokit/rest.js'
|
||||
|
||||
export const getOctokit = () => octokit
|
||||
|
||||
export const context = {
|
||||
eventName: 'pull_request',
|
||||
issue: {
|
||||
number: 10
|
||||
},
|
||||
payload: {
|
||||
number: 10,
|
||||
issue: {
|
||||
number: 10
|
||||
},
|
||||
pull_request: {
|
||||
number: 10
|
||||
},
|
||||
sender: {
|
||||
login: 'mona'
|
||||
}
|
||||
},
|
||||
action: 'opened',
|
||||
repo: {
|
||||
owner: 'actions',
|
||||
repo: 'first-interaction'
|
||||
}
|
||||
}
|
||||
20
__fixtures__/@octokit/rest.ts
Normal file
20
__fixtures__/@octokit/rest.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { jest } from '@jest/globals'
|
||||
import { Endpoints } from '@octokit/types'
|
||||
|
||||
export const graphql = jest.fn()
|
||||
export const paginate = jest.fn()
|
||||
export const rest = {
|
||||
issues: {
|
||||
createComment:
|
||||
jest.fn<
|
||||
() => Endpoints['POST /repos/{owner}/{repo}/issues/{issue_number}/comments']['response']
|
||||
>(),
|
||||
listForRepo:
|
||||
jest.fn<() => Endpoints['GET /repos/{owner}/{repo}/issues']['response']>()
|
||||
},
|
||||
pulls: {
|
||||
list: jest.fn<
|
||||
() => Endpoints['GET /repos/{owner}/{repo}/pulls']['response']
|
||||
>()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user