fix: reuse oauth env wrapper · openclaw/openclaw@3290679
shakkernerd
·
2026-06-18
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,7 @@
|
5 | 5 | */ |
6 | 6 | import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; |
7 | 7 | import type { OpenClawConfig } from "../../config/config.js"; |
| 8 | +import { withEnvAsync } from "../../test-utils/env.js"; |
8 | 9 | import type { AuthProfileStore } from "./types.js"; |
9 | 10 | |
10 | 11 | vi.mock("../cli-credentials.js", () => ({ |
@@ -83,17 +84,7 @@ async function resolveWithConfig(params: {
|
83 | 84 | } |
84 | 85 | |
85 | 86 | async function withEnvVar<T>(key: string, value: string, run: () => Promise<T>): Promise<T> { |
86 | | -const previous = process.env[key]; |
87 | | -process.env[key] = value; |
88 | | -try { |
89 | | -return await run(); |
90 | | -} finally { |
91 | | -if (previous === undefined) { |
92 | | -delete process.env[key]; |
93 | | -} else { |
94 | | -process.env[key] = previous; |
95 | | -} |
96 | | -} |
| 87 | +return await withEnvAsync({ [key]: value }, run); |
97 | 88 | } |
98 | 89 | |
99 | 90 | async function expectResolvedApiKey(params: { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。