Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent spaces in names #5738

Merged
Changes from 1 commit
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
9 changes: 5 additions & 4 deletions packages/wrangler/src/__tests__/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ describe("normalizeAndValidateConfig()", () => {
describe("name", () => {
it("should error on invalid `name` value with spaces", () => {
const expectedConfig: RawEnvironment = {
name: "NCC 1701 D",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this was tripping the uppercase validation, and so the fact that the spaces validation didn't work was missed

name: "this has spaces",
} as unknown as RawEnvironment;

const { config, diagnostics } = normalizeAndValidateConfig(
Expand All @@ -1134,10 +1134,11 @@ describe("normalizeAndValidateConfig()", () => {

expect(config).toEqual(expect.objectContaining(expectedConfig));
expect(diagnostics.hasWarnings()).toBe(false);

expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- Expected \\"name\\" to be of type string, alphanumeric and lowercase with dashes only but got \\"NCC 1701 D\\"."
`);
"Processing wrangler configuration:
- Expected \\"name\\" to be of type string, alphanumeric and lowercase with dashes only but got \\"this has spaces\\"."
`);
});

it("should be valid `name` with underscores", () => {
Expand Down
Loading