diff --git a/biome.json b/biome.json
index 75bde2b..2c8ea73 100644
--- a/biome.json
+++ b/biome.json
@@ -14,7 +14,7 @@
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
- "trailingCommas": "all",
+ "trailingComma": "all",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"bracketSpacing": true,
diff --git a/lib/admin/Table.tsx b/lib/admin/Table.tsx
index 03f0a58..6937b47 100644
--- a/lib/admin/Table.tsx
+++ b/lib/admin/Table.tsx
@@ -45,7 +45,9 @@ const Cell = ({
{cellValue.map((id: string, index: number) => (
{id?.split("-")?.[0]}...
@@ -60,7 +62,9 @@ const Cell = ({
const resource = pluralize(columnKey.slice(0, -3)) // e.g., "account_id" -> "accounts"
return (
{cellValue?.split("-")?.[0]}
@@ -98,7 +102,9 @@ const Cell = ({
contentType = "application/json"
} else if (typeof cellValue === "string") {
b64 = Buffer.from(cellValue).toString("base64")
- filename = `${columnKey.split("_").slice(0, -1).join("_")}.${columnKey.split("_").pop()}`
+ filename = `${columnKey.split("_").slice(0, -1).join("_")}.${columnKey
+ .split("_")
+ .pop()}`
contentType = "application/octet-stream"
} else {
throw new Error(`Unknown cell value type: ${typeof cellValue}`)
diff --git a/lib/middleware/with-ctx-react.tsx b/lib/middleware/with-ctx-react.tsx
index 1075b5d..18fcda8 100644
--- a/lib/middleware/with-ctx-react.tsx
+++ b/lib/middleware/with-ctx-react.tsx
@@ -51,7 +51,9 @@ button {
/
{component}
@@ -74,7 +76,9 @@ button {
onchange="document.cookie = 'timezone=' + this.value + ';path=/'; location.reload();"
>
-
+
`,
diff --git a/tests/routes/things/create.test.ts b/tests/routes/things/create.test.ts
index 65e9935..5f21b45 100644
--- a/tests/routes/things/create.test.ts
+++ b/tests/routes/things/create.test.ts
@@ -4,16 +4,22 @@ import { test, expect } from "bun:test"
test("create a thing", async () => {
const { ky } = await getTestServer()
- ky.post("things/create", {
- json: {
- name: "Thing1",
- description: "Thing1 Description",
- },
- })
+ const createRes = await ky
+ .post("things/create", {
+ json: {
+ name: "Thing1",
+ description: "Thing1 Description",
+ },
+ })
+ .json<{ ok: boolean }>()
+
+ expect(createRes.ok).toBe(true)
const data = await ky
.get("things/list")
.json<{ things: { name: string; description: string }[] }>()
expect(data.things).toHaveLength(1)
+ expect(data.things[0].name).toBe("Thing1")
+ expect(data.things[0].description).toBe("Thing1 Description")
})
diff --git a/tests/routes/things/delete.test.ts b/tests/routes/things/delete.test.ts
new file mode 100644
index 0000000..611aa4e
--- /dev/null
+++ b/tests/routes/things/delete.test.ts
@@ -0,0 +1,45 @@
+import { getTestServer } from "tests/fixtures/get-test-server"
+import { test, expect } from "bun:test"
+
+test("delete a thing", async () => {
+ const { ky } = await getTestServer()
+
+ // Create a thing first
+ const createRes = await ky
+ .post("things/create", {
+ json: {
+ name: "ThingToDelete",
+ description: "Will be deleted",
+ },
+ })
+ .json<{ ok: boolean }>()
+
+ expect(createRes.ok).toBe(true)
+
+ // Verify it exists
+ const listBefore = await ky
+ .get("things/list")
+ .json<{ things: { thing_id: string; name: string }[] }>()
+
+ expect(listBefore.things).toHaveLength(1)
+ const thingId = listBefore.things[0].thing_id
+
+ // Delete the thing using URL-encoded form data
+ const deleteRes = await ky
+ .post("things/delete", {
+ body: new URLSearchParams({ thing_id: thingId }),
+ headers: {
+ "content-type": "application/x-www-form-urlencoded",
+ },
+ })
+ .json<{ ok: boolean }>()
+
+ expect(deleteRes.ok).toBe(true)
+
+ // Verify it's gone
+ const listAfter = await ky
+ .get("things/list")
+ .json<{ things: { thing_id: string; name: string }[] }>()
+
+ expect(listAfter.things).toHaveLength(0)
+})