Skip to content
This repository was 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

@bocytko

Description

@bocytko

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions