Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lrapoport-cf committed Oct 10, 2024
1 parent 11c463c commit 285e460
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions packages/wrangler/src/__tests__/kv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
KVNamespaceInfo,
NamespaceKeyInfo,
} from "../kv/helpers";
import { endEventLoop } from "./helpers/end-event-loop";

describe("wrangler", () => {
mockAccountId();
Expand Down Expand Up @@ -55,15 +56,53 @@ describe("wrangler", () => {

it("should show help when no argument is passed", async () => {
await runWrangler("kv");
expect(std.out).toMatchInlineSnapshot();
await endEventLoop();
expect(std.out).toMatchInlineSnapshot(`
"wrangler kv
🗂️ Manage Workers KV Namespaces
COMMANDS
wrangler kv namespace Interact with your Workers KV Namespaces
wrangler kv key Individually manage Workers KV key-value pairs
wrangler kv bulk Interact with multiple Workers KV key-value pairs at once
GLOBAL FLAGS
-j, --experimental-json-config Experimental: support wrangler.json [boolean]
-c, --config Path to .toml configuration file [string]
-e, --env Environment to use for operations and .env files [string]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]"
`);
});

it("should show help when an invalid argument is passed", async () => {
await expect(() => runWrangler("kv asdf")).rejects.toThrow(
"Unknown argument: asdf"
);
expect(std.err).toMatchInlineSnapshot();
expect(std.out).toMatchInlineSnapshot();
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Unknown argument: asdf
"
`);
expect(std.out).toMatchInlineSnapshot(`
"
wrangler kv
🗂️ Manage Workers KV Namespaces
COMMANDS
wrangler kv namespace Interact with your Workers KV Namespaces
wrangler kv key Individually manage Workers KV key-value pairs
wrangler kv bulk Interact with multiple Workers KV key-value pairs at once
GLOBAL FLAGS
-j, --experimental-json-config Experimental: support wrangler.json [boolean]
-c, --config Path to .toml configuration file [string]
-e, --env Environment to use for operations and .env files [string]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]"
`);
});


Expand Down

0 comments on commit 285e460

Please sign in to comment.