mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-17 09:56:06 +00:00
6baeb032a7
Co-authored-by: dadachann <dadachann@users.noreply.github.com>
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
import { createRequire } from 'node:module';
|
|
import { fileURLToPath } from 'node:url';
|
|
import ts from 'typescript';
|
|
|
|
const currentDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
const sourcePath = path.resolve(
|
|
currentDirectory,
|
|
'../../src/app/home/plugins/components/plugin-market/PluginComponentIcons.ts',
|
|
);
|
|
const source = fs.readFileSync(sourcePath, 'utf8');
|
|
const compiled = ts.transpileModule(source, {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS },
|
|
}).outputText;
|
|
const sourceRequire = createRequire(sourcePath);
|
|
const loadedModule = { exports: {} };
|
|
new Function('require', 'module', 'exports', compiled)(
|
|
sourceRequire,
|
|
loadedModule,
|
|
loadedModule.exports,
|
|
);
|
|
|
|
const { AppWindow } = sourceRequire('lucide-react');
|
|
const { pluginComponentIconMap } = loadedModule.exports;
|
|
|
|
test('maps the Page plugin component to the AppWindow icon', () => {
|
|
assert.equal(pluginComponentIconMap.Page, AppWindow);
|
|
});
|