@jjlmoya/utils-astronomy 1.17.0 → 1.18.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-astronomy",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -0,0 +1,71 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { ALL_TOOLS } from '../tools';
3
+ import { existsSync, readFileSync } from 'fs';
4
+ import { join } from 'path';
5
+
6
+ describe('Tool Structure Validation', () => {
7
+ ALL_TOOLS.forEach((tool) => {
8
+ const toolId = tool.entry.id;
9
+ const folderName = toolId.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
10
+
11
+ it(`${toolId} should have complete file structure`, () => {
12
+ const toolDir = join(process.cwd(), 'src/tool', folderName);
13
+
14
+ const enPath = join(toolDir, 'i18n', 'en.ts');
15
+ const enContent = readFileSync(enPath, 'utf-8');
16
+ const slugMatch = enContent.match(/const slug = ['"]([^'"]+)['"]/);
17
+ const englishSlug = slugMatch?.[1];
18
+
19
+ expect(
20
+ englishSlug,
21
+ `${toolId} i18n/en.ts must have: const slug = '...';`,
22
+ ).toBeTruthy();
23
+
24
+ const requiredFiles = [
25
+ 'index.ts',
26
+ 'entry.ts',
27
+ 'component.astro',
28
+ 'seo.astro',
29
+ 'bibliography.astro',
30
+ 'bibliography.ts',
31
+ `${englishSlug}.css`,
32
+ ];
33
+
34
+ requiredFiles.forEach((file) => {
35
+ const filePath = join(toolDir, file);
36
+ expect(
37
+ existsSync(filePath),
38
+ `${toolId} is missing required file: ${file}`,
39
+ ).toBe(true);
40
+ });
41
+
42
+ const indexPath = join(toolDir, 'index.ts');
43
+ const indexContent = readFileSync(indexPath, 'utf-8');
44
+ expect(
45
+ indexContent.includes('SEOComponent'),
46
+ `${toolId}/index.ts missing SEOComponent export`,
47
+ ).toBe(true);
48
+ expect(
49
+ indexContent.includes('BibliographyComponent'),
50
+ `${toolId}/index.ts missing BibliographyComponent export`,
51
+ ).toBe(true);
52
+ });
53
+
54
+ it(`${toolId} seo.astro should use SEORenderer from shared`, () => {
55
+ const seoPath = join(process.cwd(), 'src/tool', folderName, 'seo.astro');
56
+ const content = readFileSync(seoPath, 'utf-8');
57
+ expect(
58
+ content.includes("import { SEORenderer } from '@jjlmoya/utils-shared'"),
59
+ `${toolId}/seo.astro should import SEORenderer from shared`,
60
+ ).toBe(true);
61
+ });
62
+
63
+ it(`${toolId} bibliography.astro should exist`, () => {
64
+ const bibPath = join(process.cwd(), 'src/tool', folderName, 'bibliography.astro');
65
+ expect(
66
+ existsSync(bibPath),
67
+ `${toolId} is missing bibliography.astro`,
68
+ ).toBe(true);
69
+ });
70
+ });
71
+ });
@@ -2,6 +2,7 @@ import { bibliography } from '../bibliography';
2
2
  import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
3
3
  import type { EyepieceCalculatorLocaleContent } from '../entry';
4
4
 
5
+ const slug = 'smart-eyepiece-calculator';
5
6
  const title = 'Eyepiece Calculator & Visual Simulator';
6
7
  const description = 'Calculate magnification, true field of view (TFOV), and exit pupil for any eyepiece with your telescope. Features an interactive visual simulator.';
7
8
 
@@ -153,7 +154,7 @@ const appSchema: WithContext<SoftwareApplication> = {
153
154
  };
154
155
 
155
156
  export const content: EyepieceCalculatorLocaleContent = {
156
- slug: 'smart-eyepiece-calculator',
157
+ slug,
157
158
  title,
158
159
  description,
159
160
  ui,
@@ -1,16 +1,13 @@
1
1
  import type { ToolDefinition } from '../../types';
2
2
  import { eyepieceCalculator } from './entry';
3
- import SEOComponent from './seo.astro';
4
- import BibliographyComponent from './bibliography.astro';
5
3
 
6
4
  export * from './entry';
7
- export { SEOComponent, BibliographyComponent };
8
5
 
9
6
  export const EYEPIECE_CALCULATOR_TOOL: ToolDefinition = {
10
7
  entry: eyepieceCalculator,
11
8
  Component: () => import('./component.astro'),
12
- SEOComponent,
13
- BibliographyComponent,
9
+ SEOComponent: () => import('./seo.astro'),
10
+ BibliographyComponent: () => import('./bibliography.astro'),
14
11
  };
15
12
 
16
13
  export { EYEPIECE_CALCULATOR_TOOL as smartEyepieceCalculator };