From 8daec5f111b84455952f591b877b71af8d6e9c46 Mon Sep 17 00:00:00 2001 From: Paaksing Date: Thu, 7 Nov 2024 11:36:27 -0400 Subject: [PATCH] fix: path param default route summary --- docs/.vitepress/config.js | 2 +- docs/guides/code-duplication.md | 2 +- package.json | 2 +- tests/routing.test.ts | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index 4486300..cb34420 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -18,7 +18,7 @@ export default { activeMatch: "/reference/*" }, { - text: "1.1.1 (latest)", + text: "1.1.2 (latest)", items: [ { text: "Releases", link: "https://github.com/iann838/workery/releases" }, { text: "Migrations", link: "/migrations/1_0-1_1.md" } diff --git a/docs/guides/code-duplication.md b/docs/guides/code-duplication.md index 874db31..ea1d18e 100644 --- a/docs/guides/code-duplication.md +++ b/docs/guides/code-duplication.md @@ -1,6 +1,6 @@ # Code Duplication -If you notice that your code is starting to repeat statements and declaration more than a few times, it is probably time to address them. +If you notice that your code is starting to have repeated statements and declarations more than a few times, it is probably time to address them. This guide will use **repeated parameters** as the context of examples, because it's the most common place to have code duplication. However, these deduplication logics can be applied to other scenarios. diff --git a/package.json b/package.json index 0029fc5..7a775ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "workery", - "version": "1.1.1", + "version": "1.1.2", "description": "Modern web framework for building APIs on Cloudflare Workers.", "type": "module", "main": "./dist/index.cjs", diff --git a/tests/routing.test.ts b/tests/routing.test.ts index 78ff8c6..6975209 100644 --- a/tests/routing.test.ts +++ b/tests/routing.test.ts @@ -21,8 +21,13 @@ describe("function generateRouteSummary", () => { expect(generateRouteSummary("POST", "/path/to/route/")).toBe("Create Path To Route") expect(generateRouteSummary("PUT", "path/to/route/")).toBe("Update Path To Route") expect(generateRouteSummary("PUT", "path/to/route/{id}")).toBe("Update Path To Route") + expect(generateRouteSummary("GET", "/items/{itemId}/subitems")).toBe("Read Items Subitems") + expect(generateRouteSummary("GET", ";droigh/675/等级")).toBeTruthy() expect(generateRouteSummary("PATCH", "//route/")).toBe("Modify Route") expect(generateRouteSummary("DELETE", "")).toBe("Delete") + expect(generateRouteSummary("TRACE", "")).toBe("Trace") + expect(generateRouteSummary("OPTIONS", "")).toBe("Check") + expect(generateRouteSummary("HEAD", "/items")).toBe("Head Items") }) })