Skip to content

Commit

Permalink
add test for premajor version with prerelease label
Browse files Browse the repository at this point in the history
  • Loading branch information
meorphis committed Jan 29, 2024
1 parent cc7449a commit d78aa05
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6959,6 +6959,57 @@ version = "3.0.0"
expect(releases[0].tag.toString()).to.eql('release-brancher-v0.2.0');
});

it('should build prerelease releases from pre-major if the pre-release label is applied', async () => {
mockPullRequests(
github,
[],
[
{
headBranchName: 'release-please/branches/main',
baseBranchName: 'main',
number: 1234,
title: 'chore: release main',
body: pullRequestBody(
'release-notes/single-manifest-pre-major.txt'
),
labels: ['autorelease: pending', 'autorelease: pre-release'],
files: [''],
sha: 'abc123',
},
]
);
const getFileContentsStub = sandbox.stub(
github,
'getFileContentsOnBranch'
);
getFileContentsStub
.withArgs('package.json', 'main')
.resolves(
buildGitHubFileRaw(
JSON.stringify({name: '@google-cloud/release-brancher'})
)
);
const manifest = new Manifest(
github,
'main',
{
'.': {
releaseType: 'node',
prerelease: true,
},
},
{
'.': Version.parse('0.1.0'),
}
);
const releases = await manifest.buildReleases();
expect(releases).lengthOf(1);
expect(releases[0].name).to.eql('release-brancher: v0.2.0');
expect(releases[0].draft).to.be.undefined;
expect(releases[0].prerelease).to.be.true;
expect(releases[0].tag.toString()).to.eql('release-brancher-v0.2.0');
});

it('should not build prerelease releases from non-prerelease', async () => {
mockPullRequests(
github,
Expand Down

0 comments on commit d78aa05

Please sign in to comment.