Refactor VPN proxy client implementation
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import test from 'node:test';
|
||||
|
||||
const index = readFileSync(new URL('../../index.html', import.meta.url), 'utf8');
|
||||
const main = readFileSync(new URL('../../src/web/main.tsx', import.meta.url), 'utf8');
|
||||
const app = readFileSync(new URL('../../src/web/App.tsx', import.meta.url), 'utf8');
|
||||
|
||||
test('typed main is the sole browser bootstrap owner', () => {
|
||||
assert.match(index, /src="\/src\/web\/main\.tsx"/);
|
||||
assert.doesNotMatch(index, /src="\/src\/web\/App\.tsx"/);
|
||||
assert.match(main, /import \{ App \} from '\.\/App\.js'/);
|
||||
assert.match(main, /import '\.\/styles\/index\.css'/);
|
||||
assert.match(main, /document\.getElementById\('root'\)/);
|
||||
assert.match(main, /throw new Error\('Harbor root element not found'\)/);
|
||||
assert.equal((main.match(/createRoot\(/g) || []).length, 1);
|
||||
assert.match(main, /createRoot\(root\)\.render\(<App \/>\)/);
|
||||
});
|
||||
|
||||
test('App remains the exported composition component without bootstrap side effects', () => {
|
||||
assert.match(app, /export function App\(\)/);
|
||||
assert.doesNotMatch(app, /createRoot|react-dom\/client|styles(?:\/index)?\.css|getElementById\('root'\)/);
|
||||
assert.match(app, /<ClientOverviewPage/);
|
||||
assert.match(app, /<StaleBanner/);
|
||||
});
|
||||
Reference in New Issue
Block a user