Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

790 B
Raw Blame
import { nextTaskTitle } from './task-title'

describe('nextTaskTitle', () => {
    test.each([
        ['saves a new title', 'Fix the export', 'Old title', 'Fix the export'],
        ['trims surrounding whitespace', '  Fix the export  ', 'Old title', 'Fix the export'],
        ['skips a blank title', '', 'Old title', null],
        ['skips a whitespace-only title', '   ', 'Old title', null],
        ['skips an unchanged title', 'Old title', 'Old title', null],
        ['skips a title that only gained whitespace', '  Old title  ', 'Old title', null],
        ['saves over a task that has no title yet', 'Fix the export', undefined, 'Fix the export'],
    ])('%s', (_name, input, currentTitle, expected) => {
        expect(nextTaskTitle(input, currentTitle)).toBe(expected)
    })
})