@podosoft/podokit 1.1.2 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -6
- package/dist/templates/base/AGENTS.md +9 -3
- package/dist/templates/base/README.md +12 -8
- package/dist/templates/fullstack/AGENTS.md +20 -2
- package/dist/templates/fullstack/README.md +65 -8
- package/dist/templates/fullstack/apps/api/package.json +1 -1
- package/dist/templates/modules/auth/files/apps/api/src/auth/account-issuer-migration.spec.ts +66 -148
- package/dist/templates/modules/auth/files/apps/api/src/auth/account-issuer-migration.ts +60 -197
- package/dist/templates/modules/auth/files/apps/api/src/migrate.ts +2 -0
- package/dist/templates/modules/auth/module.manifest.json +5 -5
- package/dist/templates/modules/object-storage-s3/files/tests/api/storage.api.spec.ts +7 -3
- package/dist/templates/todo/AGENTS.md +24 -5
- package/dist/templates/todo/README.md +64 -11
- package/dist/templates/todo/apps/api/src/migrations/1720100000000-InitTodos.ts +11 -0
- package/dist/templates/todo/apps/api/src/todos/todo.repository.spec.ts +76 -0
- package/dist/templates/todo/apps/api/src/todos/todo.repository.ts +9 -4
- package/dist/templates/todo/tests/api/todo.api.spec.ts +32 -0
- package/dist/templates/todo/tests/ui/todo.ui.spec.ts +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { expect, test } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("Todo CRUD preserves UUIDs, booleans, and timestamps @smoke", async ({ request, baseURL }): Promise<void> => {
|
|
4
|
+
const title = `Todo API ${crypto.randomUUID()}`;
|
|
5
|
+
const headers = { Origin: baseURL ?? "http://localhost:5001" };
|
|
6
|
+
const response = await request.post("/api/todos", { data: { title }, headers });
|
|
7
|
+
expect(response.status()).toBe(201);
|
|
8
|
+
const created: unknown = await response.json();
|
|
9
|
+
expect(created).toMatchObject({ title, completed: false, id: expect.any(String), createdAt: expect.any(String) });
|
|
10
|
+
if (typeof created !== "object" || created === null || !("id" in created) || typeof created.id !== "string"
|
|
11
|
+
|| !("createdAt" in created) || typeof created.createdAt !== "string") {
|
|
12
|
+
throw new Error("Todo response must include an ID and timestamp");
|
|
13
|
+
}
|
|
14
|
+
const id = created.id;
|
|
15
|
+
try {
|
|
16
|
+
expect(id).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
17
|
+
expect(new Date(created.createdAt).toISOString()).toBe(created.createdAt);
|
|
18
|
+
const list = await request.get("/api/todos");
|
|
19
|
+
expect(list.status()).toBe(200);
|
|
20
|
+
expect(await list.json()).toEqual(expect.arrayContaining([created]));
|
|
21
|
+
|
|
22
|
+
const update = await request.patch(`/api/todos/${id}`, { data: { title: `${title} updated`, completed: true }, headers });
|
|
23
|
+
expect(update.status()).toBe(200);
|
|
24
|
+
expect(await update.json()).toEqual({ ...created, title: `${title} updated`, completed: true });
|
|
25
|
+
expect((await request.delete(`/api/todos/${id}`, { headers })).status()).toBe(204);
|
|
26
|
+
expect((await request.get(`/api/todos/${id}`)).status()).toBe(404);
|
|
27
|
+
expect((await request.patch(`/api/todos/${id}`, { data: { completed: false }, headers })).status()).toBe(404);
|
|
28
|
+
expect((await request.delete(`/api/todos/${id}`, { headers })).status()).toBe(404);
|
|
29
|
+
} finally {
|
|
30
|
+
await request.delete(`/api/todos/${id}`, { headers });
|
|
31
|
+
}
|
|
32
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { expect, test } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("Todo items persist through create, complete, reload, and delete @smoke", async ({ page, request, baseURL }): Promise<void> => {
|
|
4
|
+
const title = `Todo UI ${crypto.randomUUID()}`;
|
|
5
|
+
try {
|
|
6
|
+
await page.goto("/");
|
|
7
|
+
await page.getByPlaceholder("Add a todo…").fill(title);
|
|
8
|
+
await page.getByRole("button", { name: "Add", exact: true }).click();
|
|
9
|
+
const row = page.getByRole("listitem").filter({ hasText: title });
|
|
10
|
+
await expect(row).toBeVisible();
|
|
11
|
+
await expect(row.getByRole("checkbox")).not.toBeChecked();
|
|
12
|
+
await row.getByRole("checkbox").check();
|
|
13
|
+
await expect(row.getByRole("checkbox")).toBeChecked();
|
|
14
|
+
await page.reload();
|
|
15
|
+
await expect(row.getByRole("checkbox")).toBeChecked();
|
|
16
|
+
await row.getByRole("button", { name: "Delete", exact: true }).click();
|
|
17
|
+
await expect(row).toHaveCount(0);
|
|
18
|
+
await page.reload();
|
|
19
|
+
await expect(row).toHaveCount(0);
|
|
20
|
+
} finally {
|
|
21
|
+
const items: unknown = await (await request.get("/api/todos")).json();
|
|
22
|
+
if (Array.isArray(items)) {
|
|
23
|
+
for (const item of items as unknown[]) {
|
|
24
|
+
if (typeof item === "object" && item !== null && "title" in item && item.title === title
|
|
25
|
+
&& "id" in item && typeof item.id === "string") {
|
|
26
|
+
await request.delete(`/api/todos/${item.id}`, { headers: { Origin: baseURL ?? "http://localhost:5001" } });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podosoft/podokit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "An opinionated Bun and Elysia full-stack TypeScript starter toolkit and CLI with SvelteKit, TailwindCSS, shadcn-svelte, Docker, and k3s.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|