/* eslint-env jest */ import { bandLabel, measure, outsideBand, type Band } from '../bands'; const title: Band = { min: 50, max: 60, unit: 'characters' }; const keyword: Band = { min: 2, max: 4, unit: 'words' }; const slug: Band = { max: 75, unit: 'characters' }; describe('the length bands of the Fix with AI fields', () => { it('reads as the merchant would say it', () => { expect(bandLabel(title)).toBe('50–60 characters'); expect(bandLabel(slug)).toBe('up to 75 characters'); }); it('counts a keyword in words, like its band', () => { expect(measure(keyword, 'how to season a cast iron pan guide')).toBe( '8 words' ); expect(measure(keyword, 'skillet')).toBe('1 word'); }); it('flags a proposal outside its band', () => { expect(outsideBand(title, 'x'.repeat(67))).toBe(true); expect(outsideBand(title, 'x'.repeat(55))).toBe(false); expect(outsideBand(keyword, 'cast iron skillet')).toBe(false); expect(outsideBand(keyword, 'how to season a cast iron pan guide')).toBe( true ); expect(outsideBand(slug, 'short-slug')).toBe(false); }); });