Skip to content

Commit

Permalink
Remove constellation commands from wrangler (#4545)
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym authored Jul 25, 2024
1 parent e6ada07 commit e5afae0
Show file tree
Hide file tree
Showing 35 changed files with 11 additions and 1,221 deletions.
6 changes: 6 additions & 0 deletions .changeset/five-berries-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"wrangler": minor
---

Remove experimental/beta constellation commands and binding, please migrate to Workers AI, learn more here https://developers.cloudflare.com/workers-ai/.
This is not deemed a major version bump for Wrangler since these commands were never generally available.
98 changes: 0 additions & 98 deletions packages/wrangler/src/__tests__/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe("normalizeAndValidateConfig()", () => {
configPath: undefined,
d1_databases: [],
vectorize: [],
constellation: [],
hyperdrive: [],
dev: {
ip: process.platform === "win32" ? "127.0.0.1" : "localhost",
Expand Down Expand Up @@ -2218,103 +2217,6 @@ describe("normalizeAndValidateConfig()", () => {
});
});

describe("[constellation]", () => {
it("should error if constellation is an object", () => {
const { diagnostics } = normalizeAndValidateConfig(
{ constellation: {} } as unknown as RawConfig,
undefined,
{ env: undefined }
);

expect(diagnostics.hasWarnings()).toBe(false);
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- The field \\"constellation\\" should be an array but got {}."
`);
});

it("should error if constellation is a string", () => {
const { diagnostics } = normalizeAndValidateConfig(
{ constellation: "BAD" } as unknown as RawConfig,
undefined,
{ env: undefined }
);

expect(diagnostics.hasWarnings()).toBe(false);
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- The field \\"constellation\\" should be an array but got \\"BAD\\"."
`);
});

it("should error if constellation is a number", () => {
const { diagnostics } = normalizeAndValidateConfig(
{ constellation: 999 } as unknown as RawConfig,
undefined,
{ env: undefined }
);

expect(diagnostics.hasWarnings()).toBe(false);
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- The field \\"constellation\\" should be an array but got 999."
`);
});

it("should error if constellation is null", () => {
const { diagnostics } = normalizeAndValidateConfig(
{ constellation: null } as unknown as RawConfig,
undefined,
{ env: undefined }
);

expect(diagnostics.hasWarnings()).toBe(false);
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- The field \\"constellation\\" should be an array but got null."
`);
});

it("should accept valid bindings", () => {
const { diagnostics } = normalizeAndValidateConfig(
{
constellation: [{ binding: "VALID", project_id: "ID" }],
} as unknown as RawConfig,
undefined,
{ env: undefined }
);

expect(diagnostics.hasErrors()).toBe(false);
});

it("should error if constellation.bindings are not valid", () => {
const { diagnostics } = normalizeAndValidateConfig(
{
constellation: [
{},
{ binding: "VALID" },
{ binding: 2000, project: 2111 },
],
} as unknown as RawConfig,
undefined,
{ env: undefined }
);
expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- Unexpected fields found in constellation[2] field: \\"project\\""
`);
expect(diagnostics.hasWarnings()).toBe(true);
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- \\"constellation[0]\\" bindings should have a string \\"binding\\" field but got {}.
- \\"constellation[0]\\" bindings must have a \\"project_id\\" field but got {}.
- \\"constellation[1]\\" bindings must have a \\"project_id\\" field but got {\\"binding\\":\\"VALID\\"}.
- \\"constellation[2]\\" bindings should have a string \\"binding\\" field but got {\\"binding\\":2000,\\"project\\":2111}.
- \\"constellation[2]\\" bindings must have a \\"project_id\\" field but got {\\"binding\\":2000,\\"project\\":2111}."
`);
});
});

describe("[hyperdrive]", () => {
it("should error if hyperdrive is an object", () => {
const { diagnostics } = normalizeAndValidateConfig(
Expand Down
Loading

0 comments on commit e5afae0

Please sign in to comment.