Skip to content

Commit feca5e3

Browse files
petebacondarwinpenalosa
authored andcommitted
[wrangler] fix: update remote proxy session error test snapshots (#13935)
1 parent 3cc3f6b commit feca5e3

2 files changed

Lines changed: 21 additions & 12 deletions

File tree

fixtures/get-platform-proxy-remote-bindings/tests/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ if (auth) {
246246
}>({
247247
configPath: "./.tmp/config-with-invalid-account-id/wrangler.json",
248248
})
249-
).rejects.toThrowError(
250-
/Failed to start the remote proxy session\. Failed to create a preview token/
249+
).rejects.toMatchInlineSnapshot(
250+
`[Error: Failed to start the remote proxy session. Error reloading remote server: A request to the Cloudflare API (/accounts/NOT a valid account id/workers/subdomain/edge-preview) failed.]`
251251
);
252252

253253
expect(errorSpy).toHaveBeenCalledOnce();

packages/wrangler/e2e/remote-binding/remote-bindings-api.test.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
importWrangler,
77
WranglerE2ETestHelper,
88
} from "../helpers/e2e-wrangler-test";
9+
import { normalizeOutput } from "../helpers/normalize";
910
import type {
1011
MiniflareOptions,
1112
Miniflare as MiniflareType,
@@ -82,8 +83,9 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
8283
});
8384

8485
test("user provided incorrect auth data", async ({ expect }) => {
85-
await expect(
86-
startRemoteProxySession(
86+
let error: unknown;
87+
try {
88+
await startRemoteProxySession(
8789
{
8890
MY_SERVICE: {
8991
type: "service",
@@ -98,9 +100,12 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
98100
},
99101
},
100102
}
101-
)
102-
).rejects.toThrowError(
103-
/Failed to start the remote proxy session\. Failed to create a preview token/
103+
);
104+
} catch (e) {
105+
error = e;
106+
}
107+
expect(normalizeOutput(`${error}`)).toMatchInlineSnapshot(
108+
`"Error: Failed to start the remote proxy session. Error reloading remote server: A request to the Cloudflare API (/accounts/00000000000000000000000000000000/workers/subdomain/edge-preview) failed."`
104109
);
105110
});
106111
});
@@ -137,8 +142,9 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
137142
});
138143

139144
test("user provided incorrect auth data", async ({ expect }) => {
140-
await expect(
141-
maybeStartOrUpdateRemoteProxySession(
145+
let error: unknown;
146+
try {
147+
await maybeStartOrUpdateRemoteProxySession(
142148
{
143149
bindings: {
144150
MY_SERVICE: {
@@ -155,9 +161,12 @@ describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)(
155161
apiToken: "This is an incorrect API TOKEN!",
156162
},
157163
}
158-
)
159-
).rejects.toThrowError(
160-
/Failed to start the remote proxy session\. Failed to create a preview token/
164+
);
165+
} catch (e) {
166+
error = e;
167+
}
168+
expect(normalizeOutput(`${error}`)).toMatchInlineSnapshot(
169+
`"Error: Failed to start the remote proxy session. Error reloading remote server: A request to the Cloudflare API (/accounts/00000000000000000000000000000000/workers/subdomain/edge-preview) failed."`
161170
);
162171
});
163172
});

0 commit comments

Comments
 (0)