refactor: migrate monorepo from pnpm to Bun runtime and workspaces
- root: bun workspaces via package.json, packageManager bun@1.4.0, scripts use bun --filter - backend: Bun.serve, bun test (vitest removed), bun --watch dev script, tsconfig types bun - tests: migrate 6 test files from vitest to bun:test (mock.module) - validate: replace @hono/zod-validator with hono validator + zod safeParse (fixes TS2589) - lockfile: bunfig.toml saveTextLockfile, regenerated bun.lock (text) for turbo - docs: AGENTS.md, README.md, stack.md updated to Bun stack
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { beforeEach, describe, expect, it, mock, vi } from 'bun:test';
|
||||
import { Hono } from 'hono';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
vi.mock('@/lib/prisma', () => ({
|
||||
mock.module('@/lib/prisma', () => ({
|
||||
default: {
|
||||
student: {
|
||||
findMany: vi.fn(),
|
||||
count: vi.fn(),
|
||||
findMany: mock(),
|
||||
count: mock(),
|
||||
},
|
||||
},
|
||||
getPrismaClient: vi.fn(),
|
||||
getPrismaClient: mock(),
|
||||
UnitOfWork: class {},
|
||||
}));
|
||||
|
||||
@@ -37,8 +37,8 @@ describe('students routes', () => {
|
||||
});
|
||||
|
||||
it('lists students with pagination', async () => {
|
||||
vi.mocked(prisma.student.findMany).mockResolvedValue([student]);
|
||||
vi.mocked(prisma.student.count).mockResolvedValue(21);
|
||||
prisma.student.findMany.mockResolvedValue([student]);
|
||||
prisma.student.count.mockResolvedValue(21);
|
||||
|
||||
const res = await app.request('/students?page=2&pageSize=10');
|
||||
|
||||
@@ -62,8 +62,8 @@ describe('students routes', () => {
|
||||
});
|
||||
|
||||
it('uses default pagination', async () => {
|
||||
vi.mocked(prisma.student.findMany).mockResolvedValue([]);
|
||||
vi.mocked(prisma.student.count).mockResolvedValue(0);
|
||||
prisma.student.findMany.mockResolvedValue([]);
|
||||
prisma.student.count.mockResolvedValue(0);
|
||||
|
||||
const res = await app.request('/students');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user