import { describe, expect, it } from 'vitest'; import { shortToolDescription, shortToolTitle } from './toolPresentation'; import type { ResolvedApp } from './types'; function app(id: string, name: string, description: string): ResolvedApp { return { id, name, description } as ResolvedApp; } describe('compact tool presentation', () => { it('uses the requested Audio & Video tile copy', () => { const audioVideo = app( 'de.add-ideas.av-tools', 'Audio & Video Tools', 'Convert and lightly edit audio and video locally in the browser.' ); expect(shortToolTitle(audioVideo)).toBe('Audio & Video'); expect(shortToolDescription(audioVideo)).toBe('Convert and edit locally.'); }); it('uses the requested Regex tile copy', () => { const regex = app( 'de.add-ideas.regex-tools', 'Regex Tools', 'Develop, explain, test and apply regular expressions locally in the browser.' ); expect(shortToolTitle(regex)).toBe('Regex'); expect(shortToolDescription(regex)).toBe('Explain and test locally.'); }); it('uses the compact SVG tile copy', () => { const svg = app( 'de.add-ideas.svg-tools', 'SVG Tools', 'Inspect, edit, optimize and transform SVG documents locally in the browser.' ); expect(shortToolTitle(svg)).toBe('SVG'); expect(shortToolDescription(svg)).toBe('Inspect and edit vectors locally.'); }); it('uses the compact authentication tile copy', () => { const auth = app( 'de.add-ideas.auth-tools', 'OTP & Passkey Tools', 'Generate, inspect and verify OTP credentials and test WebAuthn/passkey ceremonies locally in the browser.' ); expect(shortToolTitle(auth)).toBe('OTP & Passkeys'); expect(shortToolDescription(auth)).toBe( 'Inspect and test authentication locally.' ); }); it('uses the compact Sudoku tile copy', () => { const sudoku = app( 'de.add-ideas.sudoku-tools', 'Sudoku Tools', 'Set, play, solve and analyse Sudoku puzzles locally in the browser.' ); expect(shortToolTitle(sudoku)).toBe('Sudoku'); expect(shortToolDescription(sudoku)).toBe('Set, play and solve locally.'); }); it('uses the compact Colour tile copy', () => { const colour = app( 'de.add-ideas.colour-tools', 'Colour Tools', 'Convert, composite, compare and build colours locally in the browser.' ); expect(shortToolTitle(colour)).toBe('Colour'); expect(shortToolDescription(colour)).toBe( 'Convert and build colours locally.' ); }); it('uses the compact Office tile copy', () => { const office = app( 'de.add-ideas.office-tools', 'Office Tools', 'Open and inspect documents, spreadsheets and presentations locally in the browser.' ); expect(shortToolTitle(office)).toBe('Office'); expect(shortToolDescription(office)).toBe('Open office files locally.'); }); });