Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/cli/src/__tests__/digitalocean-token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,16 @@ describe("doApi 401 OAuth recovery", () => {
state.token = "expired-token";
let callCount = 0;
globalThis.fetch = mock((url: string | URL | Request) => {
callCount++;
const urlStr = String(url);
// Ignore unrelated fetch calls (e.g. telemetry) that may fire in parallel
if (!urlStr.includes("digitalocean")) {
return Promise.resolve(
new Response("", {
status: 200,
}),
);
}
callCount++;
// First call: the actual API call returning 401
if (callCount === 1) {
return Promise.resolve(
Expand Down
11 changes: 10 additions & 1 deletion packages/cli/src/__tests__/hetzner-cov.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,16 @@ describe("hetzner/createServer", () => {
},
};
let callCount = 0;
global.fetch = mock(() => {
global.fetch = mock((url: string | URL | Request) => {
const urlStr = String(url);
// Ignore unrelated fetch calls (e.g. telemetry) that may fire in parallel
if (!urlStr.includes("hetzner")) {
return Promise.resolve(
new Response("", {
status: 200,
}),
);
}
callCount++;
if (callCount <= 1) {
// Token validation
Expand Down
Loading