Skip to content

timestamp.test.ts defines shared helper functions inline instead of importing from helpers.ts #39683

@amitkumarashutosh

Description

@amitkumarashutosh

Description:

In timestamp.test.ts, common helper functions plain, paragraph, bold, and strike are defined inline instead of being imported from the shared helpers.ts file used by all other test files in the same directory.

Expected Behavior

timestamp.test.ts should import plain, paragraph, bold, and strike from helpers.ts, consistent with every other test file in the package.

Current Behavior

// these are defined inline in timestamp.test.ts
const plain = (value: string) => ({ type: 'PLAIN_TEXT' as const, value });
const paragraph = (value: Array<Record<string, unknown>>) => ({ type: 'PARAGRAPH' as const, value });
const bold = (value: Array<Record<string, unknown>>) => ({ type: 'BOLD' as const, value });
const strike = (value: Array<Record<string, unknown>>) => ({ type: 'STRIKE' as const, value });

Steps to Reproduce

See packages/message-parser/tests/timestamp.test.ts

Additional Context

  • Every other test file in the package imports these helpers from helpers.ts
  • If the shape of a node changes in helpers.ts, the inline definitions in timestamp.test.ts could silently drift out of sync
  • The fix is purely a code cleanup with no behavior change

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurePull requests that introduces new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions