Skip to content

Commit 65d3980

Browse files
committed
fix tests
1 parent 3845580 commit 65d3980

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

packages/wrangler/src/__tests__/provision.test.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ describe("--x-provision", () => {
192192
Provisioning R2 (R2 Bucket)...
193193
✨ R2 provisioned 🎉
194194
195+
Your Worker was deployed with provisioned resources. We've written the IDs of these resources to your config file, which you can choose to save or discard—either way future deploys will continue to work.
195196
🎉 All resources provisioned, continuing with deployment...
196197
197198
Worker Startup Time: 100 ms
@@ -208,9 +209,6 @@ describe("--x-provision", () => {
208209
`);
209210
expect(std.err).toMatchInlineSnapshot(`""`);
210211
expect(std.warn).toMatchInlineSnapshot(`""`);
211-
212-
// IDs should be written back to the config file
213-
expect(await readFile("wrangler.toml", "utf-8")).toMatchInlineSnapshot();
214212
});
215213

216214
it("can provision KV, R2 and D1 bindings with existing resources, and lets you search when there are too many to list", async () => {
@@ -312,6 +310,7 @@ describe("--x-provision", () => {
312310
Provisioning R2 (R2 Bucket)...
313311
✨ R2 provisioned 🎉
314312
313+
Your Worker was deployed with provisioned resources. We've written the IDs of these resources to your config file, which you can choose to save or discard—either way future deploys will continue to work.
315314
🎉 All resources provisioned, continuing with deployment...
316315
317316
Worker Startup Time: 100 ms
@@ -442,6 +441,7 @@ describe("--x-provision", () => {
442441
🌀 Creating new R2 Bucket \\"new-r2\\"...
443442
✨ R2 provisioned 🎉
444443
444+
Your Worker was deployed with provisioned resources. We've written the IDs of these resources to your config file, which you can choose to save or discard—either way future deploys will continue to work.
445445
🎉 All resources provisioned, continuing with deployment...
446446
447447
Worker Startup Time: 100 ms
@@ -458,6 +458,26 @@ describe("--x-provision", () => {
458458
`);
459459
expect(std.err).toMatchInlineSnapshot(`""`);
460460
expect(std.warn).toMatchInlineSnapshot(`""`);
461+
462+
// IDs should be written back to the config file
463+
expect(await readFile("wrangler.toml", "utf-8")).toMatchInlineSnapshot(`
464+
"compatibility_date = \\"2022-01-12\\"
465+
name = \\"test-name\\"
466+
main = \\"index.js\\"
467+
468+
[[kv_namespaces]]
469+
binding = \\"KV\\"
470+
id = \\"new-kv-id\\"
471+
472+
[[r2_buckets]]
473+
binding = \\"R2\\"
474+
bucket_name = \\"new-r2\\"
475+
476+
[[d1_databases]]
477+
binding = \\"D1\\"
478+
database_id = \\"new-d1-id\\"
479+
"
480+
`);
461481
});
462482

463483
it("can prefill d1 database name from config file if provided", async () => {
@@ -511,6 +531,7 @@ describe("--x-provision", () => {
511531
🌀 Creating new D1 Database \\"prefilled-d1-name\\"...
512532
✨ D1 provisioned 🎉
513533
534+
Your Worker was deployed with provisioned resources. We've written the IDs of these resources to your config file, which you can choose to save or discard—either way future deploys will continue to work.
514535
🎉 All resources provisioned, continuing with deployment...
515536
516537
Worker Startup Time: 100 ms
@@ -633,6 +654,7 @@ describe("--x-provision", () => {
633654
🌀 Creating new D1 Database \\"new-d1-name\\"...
634655
✨ D1 provisioned 🎉
635656
657+
Your Worker was deployed with provisioned resources. We've written the IDs of these resources to your config file, which you can choose to save or discard—either way future deploys will continue to work.
636658
🎉 All resources provisioned, continuing with deployment...
637659
638660
Worker Startup Time: 100 ms
@@ -708,6 +730,7 @@ describe("--x-provision", () => {
708730
🌀 Creating new R2 Bucket \\"prefilled-r2-name\\"...
709731
✨ BUCKET provisioned 🎉
710732
733+
Your Worker was deployed with provisioned resources. We've written the IDs of these resources to your config file, which you can choose to save or discard—either way future deploys will continue to work.
711734
🎉 All resources provisioned, continuing with deployment...
712735
713736
Worker Startup Time: 100 ms
@@ -894,6 +917,7 @@ describe("--x-provision", () => {
894917
🌀 Creating new R2 Bucket \\"existing-bucket-name\\"...
895918
✨ BUCKET provisioned 🎉
896919
920+
Your Worker was deployed with provisioned resources. We've written the IDs of these resources to your config file, which you can choose to save or discard—either way future deploys will continue to work.
897921
🎉 All resources provisioned, continuing with deployment...
898922
899923
Worker Startup Time: 100 ms

packages/wrangler/src/deployment-bundle/bindings.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import assert from "node:assert";
22
import { fetchResult } from "../cfetch";
3-
import { experimental_patchConfig } from "../cli";
4-
import { PatchConfigError } from "../config/patch-config";
3+
import {
4+
experimental_patchConfig,
5+
PatchConfigError,
6+
} from "../config/patch-config";
57
import { createD1Database } from "../d1/create";
68
import { listDatabases } from "../d1/list";
79
import { getDatabaseInfoFromIdOrName } from "../d1/utils";

0 commit comments

Comments
 (0)