@jjlmoya/utils-streaming 1.20.0 → 1.21.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjlmoya/utils-streaming",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -0,0 +1,22 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { resolve } from 'node:path';
4
+
5
+ const toolSeoFiles = [
6
+ 'sorteo/seo.astro',
7
+ 'tebasCheck/seo.astro',
8
+ 'videoBitratePlanner/seo.astro',
9
+ ];
10
+
11
+ describe('SEO component contract', () => {
12
+ for (const relativePath of toolSeoFiles) {
13
+ it(`${relativePath} loads localized SEO sections from locale`, async () => {
14
+ const source = await readFile(resolve(__dirname, '../tool', relativePath), 'utf8');
15
+
16
+ expect(source).toMatch(/locale\?: KnownLocale/);
17
+ expect(source).toMatch(/locale = 'es'/);
18
+ expect(source).toMatch(/entry\.i18n\[locale\]\?\.\(\)/);
19
+ expect(source).toMatch(/sections: content\.seo/);
20
+ });
21
+ }
22
+ });
@@ -1,12 +1,15 @@
1
1
  ---
2
2
  import { SEORenderer } from '@jjlmoya/utils-shared';
3
- import type { UtilitySEOContent } from '@jjlmoya/utils-shared';
3
+ import { VIDEO_BITRATE_PLANNER_TOOL } from './index';
4
+ import type { KnownLocale } from '../../types';
4
5
 
5
6
  interface Props {
6
- content: UtilitySEOContent;
7
+ locale?: KnownLocale;
7
8
  }
8
9
 
9
- const { content } = Astro.props;
10
+ const { locale = 'es' } = Astro.props;
11
+ const content = await VIDEO_BITRATE_PLANNER_TOOL.entry.i18n[locale]?.();
12
+ if (!content) return null;
10
13
  ---
11
14
 
12
- <SEORenderer content={content} />
15
+ {content.seo?.length > 0 && <SEORenderer content={{ locale, sections: content.seo }} />}