Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Unexpected rejection of the PR title: "PR's title is too short (8/8)" #646

Open
bocytko opened this issue Jan 26, 2023 · 0 comments
Open

Comments

@bocytko
Copy link
Member

bocytko commented Jan 26, 2023

The PR title check uses 'greater than' as operator:

const isLongEnough = (str, requiredLength) => (str || '').length > requiredLength

This means that for a length of 8, it requires a length of 9 for the test to pass.
The error message will say: PR's title is too short (8/8).

This likely slipped through the tests, that verify the logic for 'short' which has 5 characters:

it(`[action: '${action}'] should set status to 'failure' if PR's title's length is less than ${TITLE_REQUIRED_LENGTH}`, async (done) => {
try {
const title = 'short'
const payload = createPayload(action, {
title,
state: 'open',
body: 'This one is a good body for the PR'
})
await pullRequest.execute(config(), payload, TOKEN)
expect(github.setCommitStatus.calledWithExactly(
'sample', 'one', '1a2b3c', {
state: 'failure',
context: 'zappr/pr/specification',
description: `PR's title is too short (${title.length}/${TITLE_REQUIRED_LENGTH})`
}, 'token'
)).to.be.true

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant