fix: resizing etc

This commit is contained in:
Brooklyn Nicholson 2026-04-09 00:46:35 -05:00
parent 54bd25ff4a
commit 8755b9dfc0
3 changed files with 36 additions and 28 deletions

View file

@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import { sameToolTrailGroup } from '../lib/text.js'
import { fmtK, sameToolTrailGroup } from '../lib/text.js'
describe('sameToolTrailGroup', () => {
it('matches bare check lines', () => {
@ -18,3 +18,19 @@ describe('sameToolTrailGroup', () => {
expect(sameToolTrailGroup('🔍 searching', '🔍 searching extra ✓')).toBe(false)
})
})
describe('fmtK', () => {
it('keeps small numbers plain', () => {
expect(fmtK(999)).toBe('999')
})
it('formats thousands as K', () => {
expect(fmtK(1000)).toBe('1K')
expect(fmtK(1500)).toBe('1.5K')
})
it('formats millions and billions', () => {
expect(fmtK(1_000_000)).toBe('1M')
expect(fmtK(1_000_000_000)).toBe('1B')
})
})