polymech - fw latest | web ui
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Component": "C:\\Users\\zx\\Desktop\\polymech\\polymech-fw-apps\\cassandra-rc2\\lib\\polymech-base\\src\\SerialMessage.h"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { findComponents } from '../../src/lib/di.js';
|
||||
import path from 'path';
|
||||
import fs from 'fs/promises';
|
||||
describe('Component Discovery', () => {
|
||||
it('should scan the project and produce a map of all valid components', async () => {
|
||||
const projectRoot = path.resolve(process.cwd(), '..', 'cassandra-rc2');
|
||||
const includeDirs = [
|
||||
path.join(projectRoot, 'src'),
|
||||
path.join(projectRoot, 'lib/polymech-base/src')
|
||||
];
|
||||
// This function scans all .h files and returns a map of ClassName -> AbsoluteFilePath
|
||||
const allComponents = await findComponents(includeDirs);
|
||||
// Save the output for inspection
|
||||
const outputDir = path.join(process.cwd(), 'tests', 'ast');
|
||||
await fs.mkdir(outputDir, { recursive: true });
|
||||
const outputPath = path.join(outputDir, 'components.json');
|
||||
// Convert Map to a plain object for pretty JSON serialization
|
||||
const componentsObject = Object.fromEntries(allComponents);
|
||||
await fs.writeFile(outputPath, JSON.stringify(componentsObject, null, 2));
|
||||
// Assert that the discovery is working at a basic level
|
||||
expect(allComponents).toBeDefined();
|
||||
expect(allComponents.size).toBeGreaterThan(10); // Expect to find a reasonable number of components
|
||||
expect(allComponents.has('Plunger')).toBe(true);
|
||||
expect(allComponents.get('Plunger')).toContain('Plunger.h');
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=components.test.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"components.test.js","sourceRoot":"","sources":["components.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,IAAI,MAA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,CAAC,CAAC;QAChD,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { findComponents } from '../../src/lib/di.js';
|
||||
import path from 'path';
|
||||
import fs from 'fs/promises';
|
||||
|
||||
describe('Component Discovery', () => {
|
||||
|
||||
it('should scan the project and produce a map of all valid components', async () => {
|
||||
const projectRoot = path.resolve(process.cwd(), '..', 'cassandra-rc2');
|
||||
const includeDirs = [
|
||||
path.join(projectRoot, 'src'),
|
||||
path.join(projectRoot, 'lib/polymech-base/src')
|
||||
];
|
||||
|
||||
// This function scans all .h files and returns a map of ClassName -> AbsoluteFilePath
|
||||
const allComponents = await findComponents(includeDirs);
|
||||
|
||||
// Save the output for inspection
|
||||
const outputDir = path.join(process.cwd(), 'tests', 'ast');
|
||||
await fs.mkdir(outputDir, { recursive: true });
|
||||
const outputPath = path.join(outputDir, 'components.json');
|
||||
|
||||
// Convert Map to a plain object for pretty JSON serialization
|
||||
const componentsObject = Object.fromEntries(allComponents);
|
||||
await fs.writeFile(outputPath, JSON.stringify(componentsObject, null, 2));
|
||||
|
||||
// Assert that the discovery is working at a basic level
|
||||
expect(allComponents).toBeDefined();
|
||||
expect(allComponents.size).toBeGreaterThan(10); // Expect to find a reasonable number of components
|
||||
expect(allComponents.has('Plunger')).toBe(true);
|
||||
expect(allComponents.get('Plunger')).toContain('Plunger.h');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user