test: add HTTP2-disabled diagnostic bootstrap

This commit is contained in:
2026-08-19 12:01:00 +08:00
parent 9ff79e9681
commit 411cd9cedf
3 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
describe('HTTP/1.1 diagnostic bootstrap', () => {
it('disables HTTP/2 before Electron startup and network initialization', () => {
const source = readFileSync(resolve(process.cwd(), 'electron/main/index.ts'), 'utf8');
const disableHttp2 = source.indexOf("app.commandLine.appendSwitch('disable-http2')");
const singleInstanceLock = source.indexOf('app.requestSingleInstanceLock()');
const ready = source.indexOf('app.whenReady()');
expect(disableHttp2).toBeGreaterThan(-1);
expect(disableHttp2).toBeLessThan(singleInstanceLock);
expect(disableHttp2).toBeLessThan(ready);
});
});