pretext icon indicating copy to clipboard operation
pretext copied to clipboard

Duplicate test 'isCJK covers the newer CJK extension blocks' appears twice in layout.test.ts

Open beeegee opened this issue 7 months ago • 1 comments

Bug description

src/layout.test.ts contains two identical test entries — same description string and same body — inside the 'prepare invariants' describe block:

// line 585
test('isCJK covers the newer CJK extension blocks', () => {
  expect(isCJK('\u{2EBF0}')).toBe(true)
  expect(isCJK('\u{31350}')).toBe(true)
  expect(isCJK('\u{323B0}')).toBe(true)
  expect(isCJK('hello')).toBe(false)
})

// line 592 — byte-for-byte duplicate
test('isCJK covers the newer CJK extension blocks', () => {
  expect(isCJK('\u{2EBF0}')).toBe(true)
  expect(isCJK('\u{31350}')).toBe(true)
  expect(isCJK('\u{323B0}')).toBe(true)
  expect(isCJK('hello')).toBe(false)
})

Both entries will run under bun test but since they are identical, the second one adds zero coverage and can hide a missing test if the original intent was to cover a different extension block range.

Root cause

Copy-paste artifact. The blocks \u{2EBF0}, \u{31350}, \u{323B0} (added in PR #33) appear in both entries unchanged.

Suggested fix

Remove one of the two entries (lines 592–597). If the intent was to cover an additional range — e.g. CJK Ext I (\u{2EBF0}–\u{2EE5D}) vs Ext H (\u{31350}–\u{3134F}) separately — the second test should contain a distinct code point not exercised by the first.

beeegee avatar Apr 08 '26 06:04 beeegee

Fixed in #118 — removed the duplicate test block. The second entry was a copy-paste artifact; test count goes from 84 → 83 with no coverage lost.

beeegee avatar Apr 08 '26 10:04 beeegee