const { test } = require('node:test') const assert = require('node:assert/strict') const fs = require('node:fs') const path = require('node:path') const root = path.resolve(__dirname, '../src') const app = fs.readFileSync(path.join(root, 'renderer/src/App.tsx'), 'utf8') const view = fs.readFileSync(path.join(root, 'renderer/src/features/workspace/ModuleListView.tsx'), 'utf8') test('remote creation and Git import are enabled while raw folder import remains local', () => { assert.match(app, /allowCustomModuleCreation=\{true\}/) assert.match(app, /allowCustomModuleImport=\{true\}/) assert.match(app, /remoteGitImport=\{remoteWorkspace \? \{ workspaceRoot: localVisualizationWorkspaceRoot, onImport: importGitModule \} : undefined\}/) assert.match(view, /remoteGitImport \? { assert.match(app, /loadDockerImages=\{\(\) => remoteWorkspace\s*\? window\.remoteWorkspace\.modules\.listDockerImages\(getRemoteWorkspaceTarget\(\)\)/) const dialog = view.slice(view.indexOf('function ModuleAddDialog('), view.indexOf('function ModuleImportDialog(')) assert.match(dialog, /void loadDockerImages\(\)/) assert.doesNotMatch(dialog, /window\.localWorkspace/) const preload = fs.readFileSync(path.join(root, 'preload/index.ts'), 'utf8') const main = fs.readFileSync(path.join(root, 'main/index.ts'), 'utf8') assert.match(preload, /invoke\('remote-workspace:modules:docker-images', target\)/) assert.match(main, /handle\('remote-workspace:modules:docker-images'/) })