mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 15:23:43 +00:00
refactor: eliminate jscpd clones and boost tests
This commit is contained in:
@@ -39,6 +39,14 @@ export function getBrowserControlServerBaseUrl(): string {
|
||||
return `http://127.0.0.1:${state.testPort}`;
|
||||
}
|
||||
|
||||
export function restoreGatewayPortEnv(prevGatewayPort: string | undefined): void {
|
||||
if (prevGatewayPort === undefined) {
|
||||
delete process.env.OPENCLAW_GATEWAY_PORT;
|
||||
return;
|
||||
}
|
||||
process.env.OPENCLAW_GATEWAY_PORT = prevGatewayPort;
|
||||
}
|
||||
|
||||
export function setBrowserControlServerCreateTargetId(targetId: string | null): void {
|
||||
state.createTargetId = targetId;
|
||||
}
|
||||
@@ -332,11 +340,7 @@ export function installBrowserControlServerHooks() {
|
||||
afterEach(async () => {
|
||||
vi.unstubAllGlobals();
|
||||
vi.restoreAllMocks();
|
||||
if (state.prevGatewayPort === undefined) {
|
||||
delete process.env.OPENCLAW_GATEWAY_PORT;
|
||||
} else {
|
||||
process.env.OPENCLAW_GATEWAY_PORT = state.prevGatewayPort;
|
||||
}
|
||||
restoreGatewayPortEnv(state.prevGatewayPort);
|
||||
if (state.prevGatewayToken === undefined) {
|
||||
delete process.env.OPENCLAW_GATEWAY_TOKEN;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user