Use @actions/[email protected] to invoke GraphQL for GHES compatibility
This commit is contained in:
@@ -3,18 +3,9 @@ import {
|
||||
RequestParameters
|
||||
} from '@octokit/graphql/dist-types/types'
|
||||
|
||||
import * as Graphql from '@octokit/graphql'
|
||||
import * as Graphql from '../../src/version/graphql'
|
||||
import {GetVersionsQueryResponse} from '../../src/version'
|
||||
|
||||
import SpyInstance = jest.SpyInstance
|
||||
|
||||
export function mockGraphql(): SpyInstance<
|
||||
Promise<GraphQlQueryResponseData>,
|
||||
[string, (RequestParameters | undefined)?]
|
||||
> {
|
||||
return jest.spyOn(Graphql, 'graphql')
|
||||
}
|
||||
|
||||
export function getMockedOldestQueryResponse(
|
||||
numVersions: number
|
||||
): GetVersionsQueryResponse {
|
||||
@@ -49,8 +40,10 @@ export function getMockedOldestQueryResponse(
|
||||
|
||||
export function mockOldestQueryResponse(
|
||||
numVersions: number
|
||||
): ReturnType<typeof mockGraphql> {
|
||||
return mockGraphql().mockResolvedValue(
|
||||
getMockedOldestQueryResponse(numVersions)
|
||||
)
|
||||
) {
|
||||
const response = new Promise((resolve) => {
|
||||
resolve(getMockedOldestQueryResponse(numVersions))
|
||||
}) as Promise<GraphQlQueryResponseData>
|
||||
jest.spyOn(Graphql, 'graphql').mockImplementation(
|
||||
(token: string, query: string, parameters: RequestParameters) => response)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user