test(export): cover the export filename slug
This commit is contained in:
17
src/composables/usePngExport.test.ts
Normal file
17
src/composables/usePngExport.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { exportFilename } from './usePngExport'
|
||||
|
||||
describe('exportFilename', () => {
|
||||
it('slugifies the plan title into a .png name', () => {
|
||||
expect(exportFilename('Q3 — Checkout revamp')).toBe('macroplan-q3-checkout-revamp.png')
|
||||
})
|
||||
|
||||
it('collapses runs of punctuation/space and trims edge dashes', () => {
|
||||
expect(exportFilename(' Hello, World!! ')).toBe('macroplan-hello-world.png')
|
||||
})
|
||||
|
||||
it('falls back to a generic name when the title has no usable characters', () => {
|
||||
expect(exportFilename('')).toBe('macroplan-plan.png')
|
||||
expect(exportFilename('—— ··')).toBe('macroplan-plan.png')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user