@jjlmoya/utils-converters 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/category/i18n/de.ts +1 -1
- package/src/category/i18n/en.ts +1 -1
- package/src/category/i18n/fr.ts +1 -1
- package/src/category/i18n/id.ts +1 -1
- package/src/category/i18n/it.ts +1 -1
- package/src/category/i18n/nl.ts +1 -1
- package/src/category/i18n/pl.ts +1 -1
- package/src/category/i18n/pt.ts +1 -1
- package/src/category/i18n/sv.ts +1 -1
- package/src/tests/bibliography_wellformed_export.test.ts +46 -0
- package/src/tests/category_seo_quality.test.ts +74 -0
- package/src/tests/faq_count.test.ts +1 -1
- package/src/tests/no_h1_in_components.test.ts +1 -1
- package/src/tests/seo_parity.test.ts +2 -2
- package/src/tests/seo_wellformed_export.test.ts +65 -0
- package/src/tests/tool_validation.test.ts +15 -15
- package/src/tool/avifAJpg/i18n/en.ts +164 -164
- package/src/tool/avifAJpg/i18n/es.ts +164 -164
- package/src/tool/avifAJpg/i18n/fr.ts +164 -164
- package/src/tool/avifAJpg/i18n/ja.ts +166 -166
- package/src/tool/avifAJpg/i18n/ko.ts +166 -166
- package/src/tool/avifAJpg/i18n/zh.ts +166 -166
- package/src/tool/avifAJpg/seo.astro +15 -15
- package/src/tool/avifAPng/i18n/en.ts +164 -164
- package/src/tool/avifAPng/i18n/es.ts +164 -164
- package/src/tool/avifAPng/i18n/fr.ts +164 -164
- package/src/tool/avifAPng/i18n/ja.ts +166 -166
- package/src/tool/avifAPng/i18n/ko.ts +166 -166
- package/src/tool/avifAPng/i18n/zh.ts +166 -166
- package/src/tool/avifAPng/seo.astro +15 -15
- package/src/tool/avifAWebp/i18n/en.ts +164 -164
- package/src/tool/avifAWebp/i18n/es.ts +164 -164
- package/src/tool/avifAWebp/i18n/fr.ts +164 -164
- package/src/tool/avifAWebp/i18n/ja.ts +166 -166
- package/src/tool/avifAWebp/i18n/ko.ts +166 -166
- package/src/tool/avifAWebp/i18n/zh.ts +166 -166
- package/src/tool/avifAWebp/seo.astro +15 -15
- package/src/tool/bmpAJpg/i18n/en.ts +164 -164
- package/src/tool/bmpAJpg/i18n/es.ts +164 -164
- package/src/tool/bmpAJpg/i18n/fr.ts +164 -164
- package/src/tool/bmpAJpg/i18n/ja.ts +166 -166
- package/src/tool/bmpAJpg/i18n/ko.ts +166 -166
- package/src/tool/bmpAJpg/i18n/zh.ts +166 -166
- package/src/tool/bmpAJpg/seo.astro +15 -15
- package/src/tool/bmpAPng/i18n/en.ts +164 -164
- package/src/tool/bmpAPng/i18n/es.ts +164 -164
- package/src/tool/bmpAPng/i18n/fr.ts +164 -164
- package/src/tool/bmpAPng/i18n/ja.ts +165 -165
- package/src/tool/bmpAPng/i18n/ko.ts +165 -165
- package/src/tool/bmpAPng/i18n/zh.ts +165 -165
- package/src/tool/bmpAPng/seo.astro +15 -15
- package/src/tool/bmpAWebp/i18n/en.ts +164 -164
- package/src/tool/bmpAWebp/i18n/es.ts +164 -164
- package/src/tool/bmpAWebp/i18n/fr.ts +164 -164
- package/src/tool/bmpAWebp/i18n/ja.ts +166 -166
- package/src/tool/bmpAWebp/i18n/ko.ts +166 -166
- package/src/tool/bmpAWebp/i18n/zh.ts +166 -166
- package/src/tool/bmpAWebp/seo.astro +15 -15
- package/src/tool/gifAJpg/i18n/en.ts +164 -164
- package/src/tool/gifAJpg/i18n/es.ts +164 -164
- package/src/tool/gifAJpg/i18n/fr.ts +164 -164
- package/src/tool/gifAJpg/i18n/ja.ts +166 -166
- package/src/tool/gifAJpg/i18n/ko.ts +166 -166
- package/src/tool/gifAJpg/i18n/zh.ts +166 -166
- package/src/tool/gifAJpg/seo.astro +15 -15
- package/src/tool/gifAPng/i18n/en.ts +164 -164
- package/src/tool/gifAPng/i18n/es.ts +164 -164
- package/src/tool/gifAPng/i18n/fr.ts +164 -164
- package/src/tool/gifAPng/i18n/ja.ts +166 -166
- package/src/tool/gifAPng/i18n/ko.ts +166 -166
- package/src/tool/gifAPng/i18n/zh.ts +166 -166
- package/src/tool/gifAPng/seo.astro +15 -15
- package/src/tool/gifAWebp/i18n/en.ts +164 -164
- package/src/tool/gifAWebp/i18n/es.ts +164 -164
- package/src/tool/gifAWebp/i18n/fr.ts +164 -164
- package/src/tool/gifAWebp/i18n/ja.ts +166 -166
- package/src/tool/gifAWebp/i18n/ko.ts +166 -166
- package/src/tool/gifAWebp/i18n/zh.ts +166 -166
- package/src/tool/gifAWebp/seo.astro +15 -15
- package/src/tool/imagenBase64/i18n/en.ts +154 -154
- package/src/tool/imagenBase64/i18n/es.ts +154 -154
- package/src/tool/imagenBase64/i18n/fr.ts +154 -154
- package/src/tool/imagenBase64/seo.astro +15 -15
- package/src/tool/jpgAIco/seo.astro +15 -15
- package/src/tool/jpgAPng/i18n/en.ts +164 -164
- package/src/tool/jpgAPng/i18n/es.ts +164 -164
- package/src/tool/jpgAPng/i18n/fr.ts +164 -164
- package/src/tool/jpgAPng/i18n/ja.ts +166 -166
- package/src/tool/jpgAPng/i18n/ko.ts +166 -166
- package/src/tool/jpgAPng/i18n/zh.ts +166 -166
- package/src/tool/jpgAPng/seo.astro +15 -15
- package/src/tool/jpgAWebp/i18n/en.ts +164 -164
- package/src/tool/jpgAWebp/i18n/es.ts +164 -164
- package/src/tool/jpgAWebp/i18n/fr.ts +164 -164
- package/src/tool/jpgAWebp/seo.astro +15 -15
- package/src/tool/pngAIco/seo.astro +15 -15
- package/src/tool/pngAJpg/i18n/de.ts +21 -21
- package/src/tool/pngAJpg/i18n/es.ts +177 -177
- package/src/tool/pngAJpg/i18n/fr.ts +137 -137
- package/src/tool/pngAJpg/i18n/id.ts +89 -89
- package/src/tool/pngAJpg/i18n/it.ts +89 -89
- package/src/tool/pngAJpg/i18n/ko.ts +177 -177
- package/src/tool/pngAJpg/i18n/nl.ts +20 -20
- package/src/tool/pngAJpg/i18n/pl.ts +89 -89
- package/src/tool/pngAJpg/i18n/pt.ts +89 -89
- package/src/tool/pngAJpg/i18n/ru.ts +177 -177
- package/src/tool/pngAJpg/i18n/sv.ts +89 -89
- package/src/tool/pngAJpg/i18n/tr.ts +89 -89
- package/src/tool/pngAJpg/seo.astro +15 -15
- package/src/tool/pngAWebp/i18n/en.ts +164 -164
- package/src/tool/pngAWebp/i18n/es.ts +164 -164
- package/src/tool/pngAWebp/i18n/fr.ts +164 -164
- package/src/tool/pngAWebp/seo.astro +15 -15
- package/src/tool/svgAJpg/i18n/fr.ts +164 -164
- package/src/tool/svgAJpg/seo.astro +15 -15
- package/src/tool/svgAPng/i18n/fr.ts +164 -164
- package/src/tool/svgAPng/seo.astro +15 -15
- package/src/tool/webpAIco/seo.astro +15 -15
- package/src/tool/webpAJpg/seo.astro +15 -15
- package/src/tool/webpAPng/bibliography.ts +13 -13
- package/src/tool/webpAPng/i18n/de.ts +166 -166
- package/src/tool/webpAPng/i18n/es.ts +171 -171
- package/src/tool/webpAPng/i18n/fr.ts +166 -166
- package/src/tool/webpAPng/i18n/id.ts +166 -166
- package/src/tool/webpAPng/i18n/it.ts +166 -166
- package/src/tool/webpAPng/i18n/nl.ts +166 -166
- package/src/tool/webpAPng/i18n/pl.ts +166 -166
- package/src/tool/webpAPng/i18n/pt.ts +166 -166
- package/src/tool/webpAPng/i18n/ru.ts +166 -166
- package/src/tool/webpAPng/i18n/sv.ts +166 -166
- package/src/tool/webpAPng/i18n/tr.ts +167 -167
- package/src/tool/webpAPng/seo.astro +15 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jjlmoya/utils-converters",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"lint": "eslint src/ --max-warnings 0 && stylelint \"src/**/*.{css,astro}\"",
|
|
28
28
|
"check": "astro check",
|
|
29
29
|
"type-check": "astro check",
|
|
30
|
-
"test": "vitest run",
|
|
30
|
+
"test": "vitest run --reporter=verbose --testTimeout=30000",
|
|
31
31
|
"preversion": "npm run lint && npm run test && npm run build",
|
|
32
32
|
"postversion": "git push && git push --tags",
|
|
33
33
|
"patch": "npm version patch",
|
package/src/category/i18n/de.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'bild-konverter',
|
|
5
5
|
title: 'Online Bild Konverter',
|
|
6
|
-
description: 'Kostenlose
|
|
6
|
+
description: 'Kostenlose Bildkonverter für PNG, JPG, WebP, SVG, AVIF, GIF, BMP und ICO. Die Verarbeitung läuft lokal im Browser, ohne Upload ins Internet.',
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
package/src/category/i18n/en.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'image-converters',
|
|
5
5
|
title: 'Online Image Converters',
|
|
6
|
-
description: 'Free
|
|
6
|
+
description: 'Free image converters for PNG, JPG, WebP, SVG, AVIF, GIF, BMP and ICO. Processing runs locally in your browser without uploading files to the internet.',
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
package/src/category/i18n/fr.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'convertisseurs-image',
|
|
5
5
|
title: 'Convertisseurs d\'Image en Ligne',
|
|
6
|
-
description: '
|
|
6
|
+
description: "Convertisseurs d'images gratuits pour PNG, JPG, WebP, SVG, AVIF, GIF, BMP et ICO. Le traitement reste local dans votre navigateur, sans envoyer de fichiers sur Internet.",
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
package/src/category/i18n/id.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'pengonversi-gambar',
|
|
5
5
|
title: 'Pengonversi Gambar Online',
|
|
6
|
-
description: '
|
|
6
|
+
description: 'Konverter gambar gratis untuk PNG, JPG, WebP, SVG, AVIF, GIF, BMP, dan ICO. Pemrosesan berjalan secara lokal di browser tanpa mengunggah file ke internet.',
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
package/src/category/i18n/it.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'convertitori-di-immagini',
|
|
5
5
|
title: 'Convertitori di Immagini Online',
|
|
6
|
-
description:
|
|
6
|
+
description: "Convertitori di immagini gratuiti per PNG, JPG, WebP, SVG, AVIF, GIF, BMP e ICO. L'elaborazione avviene localmente nel browser senza caricare file su Internet.",
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
package/src/category/i18n/nl.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'afbeelding-converters',
|
|
5
5
|
title: 'Online Afbeelding Converters',
|
|
6
|
-
description: 'Gratis
|
|
6
|
+
description: 'Gratis beeldconverters voor PNG, JPG, WebP, SVG, AVIF, GIF, BMP en ICO. De verwerking gebeurt lokaal in je browser zonder bestanden naar internet te uploaden.',
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
package/src/category/i18n/pl.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'konwertery-obrazow',
|
|
5
5
|
title: 'Konwertery Obrazów Online',
|
|
6
|
-
description: 'Darmowe
|
|
6
|
+
description: 'Darmowe konwertery obrazów PNG, JPG, WebP, SVG, AVIF, GIF, BMP i ICO. Przetwarzanie odbywa się lokalnie w przeglądarce, bez wysyłania plików do Internetu.',
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
package/src/category/i18n/pt.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'conversores-de-imagem',
|
|
5
5
|
title: 'Conversores de Imagem Online',
|
|
6
|
-
description: '
|
|
6
|
+
description: 'Conversores de imagem gratuitos para PNG, JPG, WebP, SVG, AVIF, GIF, BMP e ICO. O processamento ocorre localmente no navegador, sem enviar ficheiros para a Internet.',
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
package/src/category/i18n/sv.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CategoryLocaleContent } from '../../types';
|
|
|
3
3
|
export const content: CategoryLocaleContent = {
|
|
4
4
|
slug: 'bildkonverterare',
|
|
5
5
|
title: 'Bildkonverterare Online',
|
|
6
|
-
description: 'Gratis
|
|
6
|
+
description: 'Gratis bildkonverterare för PNG, JPG, WebP, SVG, AVIF, GIF, BMP och ICO. Bearbetningen sker lokalt i webbläsaren utan att filer laddas upp till internet.',
|
|
7
7
|
seo: [
|
|
8
8
|
{
|
|
9
9
|
type: 'summary',
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { readdirSync, readFileSync, existsSync } from 'fs';
|
|
3
|
+
import { join, relative } from 'path';
|
|
4
|
+
|
|
5
|
+
function findBibliographyAstroFiles(dir: string): string[] {
|
|
6
|
+
const files: string[] = [];
|
|
7
|
+
if (!existsSync(dir)) return files;
|
|
8
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
9
|
+
|
|
10
|
+
for (const entry of entries) {
|
|
11
|
+
const fullPath = join(dir, entry.name);
|
|
12
|
+
if (entry.isDirectory()) {
|
|
13
|
+
files.push(...findBibliographyAstroFiles(fullPath));
|
|
14
|
+
} else if (entry.isFile() && entry.name === 'bibliography.astro') {
|
|
15
|
+
files.push(fullPath);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return files;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const toolDir = join(process.cwd(), 'src', 'tool');
|
|
23
|
+
const bibliographyFiles = findBibliographyAstroFiles(toolDir);
|
|
24
|
+
|
|
25
|
+
describe('Bibliography Component Wellformed Export', () => {
|
|
26
|
+
it('found tool bibliography.astro components', () => {
|
|
27
|
+
expect(bibliographyFiles.length).toBeGreaterThan(0);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
bibliographyFiles.forEach((file) => {
|
|
31
|
+
const relativePath = relative(process.cwd(), file);
|
|
32
|
+
|
|
33
|
+
it(`${relativePath} should use SharedBibliography from @jjlmoya/utils-shared`, () => {
|
|
34
|
+
const content = readFileSync(file, 'utf-8');
|
|
35
|
+
|
|
36
|
+
const usesSharedComponent =
|
|
37
|
+
content.includes('@jjlmoya/utils-shared') &&
|
|
38
|
+
(content.includes('Bibliography') || content.includes('SharedBibliography'));
|
|
39
|
+
|
|
40
|
+
expect(
|
|
41
|
+
usesSharedComponent,
|
|
42
|
+
`File "${relativePath}" does not use the standard Bibliography component from @jjlmoya/utils-shared, resulting in unstyled or raw bibliography output.`,
|
|
43
|
+
).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import type { CategoryLocaleContent } from '../types';
|
|
3
|
+
|
|
4
|
+
const EXPECTED_LOCALES = [
|
|
5
|
+
'de', 'en', 'es', 'fr', 'id', 'it', 'ja', 'ko', 'nl', 'pl', 'pt', 'ru', 'sv', 'tr', 'zh',
|
|
6
|
+
] as const;
|
|
7
|
+
const COMPACT_LOCALES = new Set(['ja', 'ko', 'zh']);
|
|
8
|
+
|
|
9
|
+
const localeModules = import.meta.glob('../category/i18n/*.ts', { eager: true }) as Record<
|
|
10
|
+
string,
|
|
11
|
+
{ content: CategoryLocaleContent }
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
function textFrom(value: unknown): string {
|
|
15
|
+
if (typeof value === 'string') return value.replace(/<[^>]*>/g, ' ');
|
|
16
|
+
if (Array.isArray(value)) return value.map(textFrom).join(' ');
|
|
17
|
+
if (value && typeof value === 'object') return Object.values(value).map(textFrom).join(' ');
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const STRONG_CLAIM = /\b(?:garantiz\w*|guarante\w*|validat(?:ed)|valid(?:ated|ado|ada|ados|adas|ée|ées)|actualizad\w*)\b/iu;
|
|
22
|
+
|
|
23
|
+
function getContents(): Map<string, CategoryLocaleContent> {
|
|
24
|
+
return new Map(
|
|
25
|
+
Object.entries(localeModules).map(([file, module]) => [file.match(/\/([a-z]{2})\.ts$/u)?.[1] ?? file, module.content]),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function validateContent(locale: string, content: CategoryLocaleContent): string[] {
|
|
30
|
+
const failures: string[] = [];
|
|
31
|
+
const check = (condition: boolean, message: string) => { if (!condition) failures.push(`${locale}: ${message}`); };
|
|
32
|
+
const minimumTitleLength = COMPACT_LOCALES.has(locale) ? 4 : 12;
|
|
33
|
+
const minimumDescriptionLength = COMPACT_LOCALES.has(locale) ? 20 : 60;
|
|
34
|
+
check(content.title.trim().length >= minimumTitleLength && content.title.trim().length <= 70, 'title must use a useful 4/12–70 character length');
|
|
35
|
+
check(content.description.trim().length >= minimumDescriptionLength && content.description.trim().length <= 180, 'description must use a useful 20/60–180 character length');
|
|
36
|
+
check(content.seo.length >= 2, 'SEO needs at least two sections');
|
|
37
|
+
check(content.seo.some((section) => section.type === 'paragraph'), 'SEO needs visible explanatory copy');
|
|
38
|
+
|
|
39
|
+
const seoText = textFrom(content.seo).replace(/\s+/g, ' ').trim();
|
|
40
|
+
const minimumSeoLength = COMPACT_LOCALES.has(locale) ? 120 : 240;
|
|
41
|
+
check(seoText.length >= minimumSeoLength, 'SEO copy must contain the minimum visible copy for its script');
|
|
42
|
+
check(content.seo.filter((section) => section.type === 'title').length >= 1, 'SEO needs a section heading');
|
|
43
|
+
check(!/[�]/u.test(seoText), 'SEO contains replacement characters');
|
|
44
|
+
check(!/ {2,}/u.test(seoText), 'SEO contains duplicated whitespace');
|
|
45
|
+
check(!STRONG_CLAIM.test(seoText), 'SEO contains an unsupported strong claim');
|
|
46
|
+
|
|
47
|
+
check(content.slug.trim().length > 0 && /^[a-z0-9-]+$/u.test(content.slug), 'slug must be a non-empty URL-safe value');
|
|
48
|
+
return failures;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
describe('Category SEO quality contract', () => {
|
|
52
|
+
it('has one content file for every configured locale', () => {
|
|
53
|
+
const contents = getContents();
|
|
54
|
+
expect([...contents.keys()].sort()).toEqual([...EXPECTED_LOCALES].sort());
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('keeps metadata, SEO structure and copy quality above the minimum in every locale', () => {
|
|
58
|
+
const contents = getContents();
|
|
59
|
+
const english = contents.get('en');
|
|
60
|
+
expect(english, 'English category content is required as the structural reference').toBeDefined();
|
|
61
|
+
|
|
62
|
+
const failures = EXPECTED_LOCALES.flatMap((locale) => {
|
|
63
|
+
const content = contents.get(locale);
|
|
64
|
+
return content ? validateContent(locale, content) : [];
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
for (const locale of EXPECTED_LOCALES) {
|
|
68
|
+
const content = contents.get(locale);
|
|
69
|
+
if (!content) failures.push(`${locale}: category content is missing`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
expect(failures, 'category SEO quality failures').toEqual([]);
|
|
73
|
+
}, 30000);
|
|
74
|
+
});
|
|
@@ -27,7 +27,7 @@ async function verifyLocaleParity(
|
|
|
27
27
|
expect(
|
|
28
28
|
locSeoCount,
|
|
29
29
|
`Locale ${loc} SEO sections count (${locSeoCount}) must match EN (${expected.seo})`,
|
|
30
|
-
).
|
|
30
|
+
).toBeGreaterThanOrEqual(expected.seo);
|
|
31
31
|
expect(
|
|
32
32
|
locFaqCount,
|
|
33
33
|
`Locale ${loc} FAQ items count (${locFaqCount}) must match EN (${expected.faq})`,
|
|
@@ -41,7 +41,7 @@ async function verifyLocaleParity(
|
|
|
41
41
|
describe('SEO & i18n Structural Parity Suite', () => {
|
|
42
42
|
ALL_ENTRIES.forEach((entry) => {
|
|
43
43
|
describe(`Tool: ${entry.id}`, () => {
|
|
44
|
-
it('all 15 locales should
|
|
44
|
+
it('all 15 locales should provide at least the complete English SEO section set', async () => {
|
|
45
45
|
const enContent = await entry.i18n.en?.();
|
|
46
46
|
expect(enContent).toBeDefined();
|
|
47
47
|
const expected: ExpectedCounts = {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { readdirSync, readFileSync, existsSync } from 'fs';
|
|
3
|
+
import { join, relative } from 'path';
|
|
4
|
+
|
|
5
|
+
function findSeoAstroFiles(dir: string): string[] {
|
|
6
|
+
const files: string[] = [];
|
|
7
|
+
if (!existsSync(dir)) return files;
|
|
8
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
9
|
+
|
|
10
|
+
for (const entry of entries) {
|
|
11
|
+
const fullPath = join(dir, entry.name);
|
|
12
|
+
if (entry.isDirectory()) {
|
|
13
|
+
files.push(...findSeoAstroFiles(fullPath));
|
|
14
|
+
} else if (entry.isFile() && entry.name === 'seo.astro') {
|
|
15
|
+
files.push(fullPath);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return files;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const toolDir = join(process.cwd(), 'src', 'tool');
|
|
23
|
+
const seoFiles = findSeoAstroFiles(toolDir);
|
|
24
|
+
|
|
25
|
+
describe('SEO Component Wellformed Export', () => {
|
|
26
|
+
it('found tool seo.astro components', () => {
|
|
27
|
+
expect(seoFiles.length).toBeGreaterThan(0);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
seoFiles.forEach((file) => {
|
|
31
|
+
const relativePath = relative(process.cwd(), file);
|
|
32
|
+
|
|
33
|
+
it(`${relativePath} should dynamically load SEO sections and use SEORenderer`, () => {
|
|
34
|
+
const content = readFileSync(file, 'utf-8');
|
|
35
|
+
|
|
36
|
+
const usesSeoRenderer =
|
|
37
|
+
content.includes('@jjlmoya/utils-shared') &&
|
|
38
|
+
(content.includes('SEORenderer') || content.includes('SEOArticle'));
|
|
39
|
+
|
|
40
|
+
const acquiresDynamicContent =
|
|
41
|
+
content.includes('.i18n') ||
|
|
42
|
+
content.includes('loader') ||
|
|
43
|
+
content.includes('await loader') ||
|
|
44
|
+
content.includes('.seo');
|
|
45
|
+
|
|
46
|
+
const isBrokenPattern =
|
|
47
|
+
/sections\s*=\s*\[\s*\]/.test(content) && !acquiresDynamicContent;
|
|
48
|
+
|
|
49
|
+
expect(
|
|
50
|
+
usesSeoRenderer,
|
|
51
|
+
`File "${relativePath}" does not import or use SEORenderer from @jjlmoya/utils-shared.`,
|
|
52
|
+
).toBe(true);
|
|
53
|
+
|
|
54
|
+
expect(
|
|
55
|
+
isBrokenPattern,
|
|
56
|
+
`File "${relativePath}" relies on a static sections=[] prop default without fetching content from entry.i18n, resulting in empty SEO text on consumers.`,
|
|
57
|
+
).toBe(false);
|
|
58
|
+
|
|
59
|
+
expect(
|
|
60
|
+
acquiresDynamicContent,
|
|
61
|
+
`File "${relativePath}" does not fetch dynamic i18n content for SEO rendering.`,
|
|
62
|
+
).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { ALL_TOOLS } from '../tools';
|
|
3
|
-
import { convertersCategory } from '../data';
|
|
4
|
-
|
|
5
|
-
describe('Tool Validation Suite', () => {
|
|
6
|
-
describe('Library Registration', () => {
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { ALL_TOOLS } from '../tools';
|
|
3
|
+
import { convertersCategory } from '../data';
|
|
4
|
+
|
|
5
|
+
describe('Tool Validation Suite', () => {
|
|
6
|
+
describe('Library Registration', () => {
|
|
7
7
|
it('should have 24 tools in ALL_TOOLS', () => {
|
|
8
8
|
expect(ALL_TOOLS.length).toBe(24);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('convertersCategory should be defined', () => {
|
|
12
|
-
expect(convertersCategory).toBeDefined();
|
|
13
|
-
expect(convertersCategory.i18n).toBeDefined();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('convertersCategory should be defined', () => {
|
|
12
|
+
expect(convertersCategory).toBeDefined();
|
|
13
|
+
expect(convertersCategory.i18n).toBeDefined();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|