Skip to content

Commit

Permalink
Fix tests for 'wrangler pages publish'
Browse files Browse the repository at this point in the history
  • Loading branch information
GregBrimble committed May 4, 2022
1 parent eaf348d commit 3753973
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 31 deletions.
31 changes: 3 additions & 28 deletions packages/wrangler/src/__tests__/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,32 +155,7 @@ describe("pages", () => {
unsetAllMocks();
});

it("should create a project with a the default production branch", async () => {
setMockResponse(
"/accounts/:accountId/pages/projects",
([_url, accountId], init) => {
expect(accountId).toEqual("some-account-id");
expect(init.method).toEqual("POST");
const body = JSON.parse(init.body as string);
expect(body).toEqual({
name: "a-new-project",
production_branch: "production",
});
return {
name: "a-new-project",
subdomain: "a-new-project.pages.dev",
production_branch: "production",
};
}
);
await runWrangler("pages project create a-new-project");
expect(std.out).toMatchInlineSnapshot(`
"✨ Successfully created the 'a-new-project' project. It will be available at https://a-new-project.pages.dev/ once you create your first deployment.
To deploy a folder of assets, run 'wrangler pages publish [directory]'."
`);
});

it("should create a project with a the default production branch", async () => {
it("should create a project with a production branch", async () => {
setMockResponse(
"/accounts/:accountId/pages/projects",
([_url, accountId], init) => {
Expand Down Expand Up @@ -316,7 +291,7 @@ describe("pages", () => {
expect(logoPNGFile.name).toEqual("logo.png");

return {
id: "2082190357cfd3617ccfe04f340c6247d4b47484797840635feb491447bcd81c",
id: "2082190357cfd3617ccfe04f340c6247",
};
}
);
Expand All @@ -330,7 +305,7 @@ describe("pages", () => {
const manifest = JSON.parse(body.get("manifest") as string);
expect(manifest).toMatchInlineSnapshot(`
Object {
"logo.png": "2082190357cfd3617ccfe04f340c6247d4b47484797840635feb491447bcd81c",
"logo.png": "2082190357cfd3617ccfe04f340c6247",
}
`);

Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/config-cache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mkdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from "fs";
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
import { dirname, join } from "path";

let cacheMessageShown = false;
Expand Down
3 changes: 1 addition & 2 deletions packages/wrangler/src/user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,14 @@ import Table from "ink-table";
import React from "react";
import { fetch } from "undici";
import { getCloudflareApiBaseUrl } from "./cfetch";
import { purgeConfigCaches } from "./config-cache";
import { getEnvironmentVariableFactory } from "./environment-variables";
import { logger } from "./logger";
import openInBrowser from "./open-in-browser";
import { parseTOML, readFileSync } from "./parse";
import type { Config } from "./config";
import type { Item as SelectInputItem } from "ink-select-input/build/SelectInput";
import type { ParsedUrlQuery } from "node:querystring";
import type { Response } from "undici";
import { purgeConfigCaches } from "./config-cache";

/**
* Try to read the API token from the environment.
Expand Down

0 comments on commit 3753973

Please sign in to comment.