fix: SEO SPA editor last fixes (3/4)

This commit is contained in:
Florian Sylvain committed 2026-10-16 16:31:17 +02:00
1 parent 470584400f
commit cb737b7ae3
19 files changed
+316 -147

No files matched your search

+17
View File
@@ -167,3 +167,20 @@ describe('parseDirectoryQuery', () => {
})
})
})
describe('slugify parity with the API slug generator', () => {
it.each([
['Crème Brûlée à la façon', 'creme-brulee-a-la-facon'],
['Straße œuvre Łódź', 'strasse-oeuvre-lodz'],
['Ångström', 'angstrom'],
['Tiếng Việt', 'ti-ng-vi-t'],
[' --Hello, World!-- ', 'hello-world'],
['', ''],
])('turns %j into %j', (text, expected) => {
expect(slugify(text, 100)).toBe(expected)
})
it('cuts to the limit and drops a trailing dash', () => {
expect(slugify('abcd efgh', 5)).toBe('abcd')
})
})
+8 -5
View File
@@ -8,13 +8,16 @@ function suggestion(code: string, params: Record<string, number> = {}): SeoSugge
}
describe('suggestionMessage', () => {
it('uses the same wording for short and long descriptions with the length filled in', () => {
it('fills the length and the maximum into the short and long description messages', () => {
const short = suggestionMessage(suggestion('desc_short', { length: 12 }))
const long = suggestionMessage(suggestion('desc_long', { length: 200 }))
const long = suggestionMessage(suggestion('desc_long', { length: 200, max: 160 }))
expect(short).toContain('12')
expect(long).toContain('200')
expect(short.replace('12', '#')).toBe(long.replace('200', '#'))
expect(short).toBe(
'The description is 12 characters. About 70 to 160 reads best in results.',
)
expect(long).toBe(
'The description is 200 characters. Search engines may cut it off after about 160.',
)
})
it('switches between the singular and plural body image wording', () => {