From 285e46060d973dba0c08d2a1ad7389690c2e5cc3 Mon Sep 17 00:00:00 2001 From: lrapoport-cf Date: Thu, 10 Oct 2024 11:27:42 -0400 Subject: [PATCH] Fix tests --- packages/wrangler/src/__tests__/kv.test.ts | 45 ++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/packages/wrangler/src/__tests__/kv.test.ts b/packages/wrangler/src/__tests__/kv.test.ts index bf1c5f9b7d6a..62ff61cbc6fa 100644 --- a/packages/wrangler/src/__tests__/kv.test.ts +++ b/packages/wrangler/src/__tests__/kv.test.ts @@ -13,6 +13,7 @@ import type { KVNamespaceInfo, NamespaceKeyInfo, } from "../kv/helpers"; +import { endEventLoop } from "./helpers/end-event-loop"; describe("wrangler", () => { mockAccountId(); @@ -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]" + `); });