* Mocks a branch `package.json` version API request. * https://docs.github.com/en/rest/reference/repos#get-repository-content.
(
branchName: string,
version: string,
opts?: {exceptionalMinor: boolean},
)
| 64 | * https://docs.github.com/en/rest/reference/repos#get-repository-content. |
| 65 | */ |
| 66 | function interceptBranchVersionRequest( |
| 67 | branchName: string, |
| 68 | version: string, |
| 69 | opts?: {exceptionalMinor: boolean}, |
| 70 | ) { |
| 71 | const pkgJson: PackageJson = {version}; |
| 72 | if (opts?.exceptionalMinor) { |
| 73 | pkgJson[exceptionalMinorPackageIndicator] = true; |
| 74 | } |
| 75 | |
| 76 | nock(getRepoApiRequestUrl()) |
| 77 | .get('/contents/%2Fpackage.json') |
| 78 | .query((params) => params['ref'] === branchName) |
| 79 | .reply(200, {content: Buffer.from(JSON.stringify(pkgJson)).toString('base64')}); |
| 80 | } |
| 81 | |
| 82 | /** Fakes a prompt confirm question with the given value. */ |
| 83 | function fakePromptConfirmValue(returnValue: boolean) { |
no test coverage detected