UNPKG

backport

Version:

A CLI tool that automates the process of backporting commits

47 lines 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken"); const fetchExistingPullRequest_1 = require("./fetchExistingPullRequest"); const accessToken = (0, getDevAccessToken_1.getDevAccessToken)(); describe('fetchExistingPullRequest', () => { describe('when PR does not exist', () => { it('returns undefined', async () => { const options = { accessToken, }; const prPayload = { owner: 'backport-org', repo: 'backport-e2e', title: 'My PR title', body: 'My PR body', head: 'sorenlouv:backport/7.8/pr-foo', base: '7.8', draft: false, }; const res = await (0, fetchExistingPullRequest_1.fetchExistingPullRequest)({ options, prPayload }); expect(res).toBe(undefined); }); }); describe('when PR exists', () => { it('returns the PR number and url', async () => { const options = { accessToken, }; const prPayload = { owner: 'backport-org', repo: 'backport-e2e', title: 'My PR title', body: 'My PR body', head: 'sorenlouv:backport/7.8/pr-9', base: '7.8', draft: false, }; const res = await (0, fetchExistingPullRequest_1.fetchExistingPullRequest)({ options, prPayload }); expect(res).toEqual({ url: 'https://github.com/backport-org/backport-e2e/pull/10', number: 10, }); }); }); }); //# sourceMappingURL=fetchExistingPullRequest.private.test.js.map