mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 22:02:16 +00:00
Merge branch 'fix/v147-nightly' into release/v1.47.0
This commit is contained in:
commit
7cb67c2e75
61 files changed
+2983
-2280
No files matched your search
@@ -60,6 +60,14 @@ import { GET } from "../route";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { requireAdmin } from "@/lib/api-handler";
|
||||
|
||||
// Reset, not clear, before every case: cases replace the paused rows, the
|
||||
// settings row and the account groups, and a cleared mock would hand the
|
||||
// next case whatever the last one left there. A reset mock goes back to the
|
||||
// empty answer it was created with.
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks();
|
||||
});
|
||||
|
||||
const groupBy = vi.mocked(prisma.providerHealth.groupBy);
|
||||
const usageRows = vi.mocked(prisma.coachUsage.findMany);
|
||||
|
||||
@@ -101,7 +109,6 @@ function group(
|
||||
|
||||
describe("GET /api/admin/provider-health", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(requireAdmin).mockResolvedValue({
|
||||
user: { id: "admin1" },
|
||||
} as never);
|
||||
@@ -302,7 +309,6 @@ describe("GET /api/admin/provider-health — pause and model check (v1.42)", ()
|
||||
const settings = vi.mocked(prisma.appSettings.findUnique);
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(requireAdmin).mockResolvedValue({
|
||||
user: { id: "admin" },
|
||||
} as never);
|
||||
|
||||
@@ -131,7 +131,10 @@ function putReq(
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
// Reset, not clear: cases replace the profile reads and the question store
|
||||
// with their own implementations, and a cleared mock keeps them. A reset
|
||||
// mock returns to the implementation it was created with.
|
||||
vi.resetAllMocks();
|
||||
requireModuleEnabled.mockResolvedValue({ enabled: true });
|
||||
});
|
||||
|
||||
|
||||
@@ -174,6 +174,10 @@ beforeEach(() => {
|
||||
vi.mocked(isModuleEnabled).mockResolvedValue(true);
|
||||
vi.mocked(requireModuleEnabled).mockResolvedValue({ enabled: true } as never);
|
||||
vi.mocked(getSession).mockResolvedValue(SESSION_OK as never);
|
||||
// A session that signed in just now, the factory's own answer. Reset, not
|
||||
// only cleared: a case below swaps in a stale session, and `clearAllMocks`
|
||||
// keeps the implementation it left behind for whichever case runs next.
|
||||
vi.mocked(prisma.session.findUnique).mockReset();
|
||||
vi.mocked(checkRateLimit).mockResolvedValue({
|
||||
allowed: true,
|
||||
limit: 60,
|
||||
|
||||
@@ -84,6 +84,10 @@ beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(getSession).mockResolvedValue(SESSION_OK as never);
|
||||
vi.mocked(validateAttachmentCandidate).mockResolvedValue({ ok: true });
|
||||
// Open again for every case (the factory's own answer): the detach case
|
||||
// closes every capability, and `clearAllMocks` would carry that refusal
|
||||
// into whichever case runs next.
|
||||
vi.mocked(requireAiCapability).mockReset();
|
||||
});
|
||||
|
||||
describe("POST attach", () => {
|
||||
|
||||
@@ -276,7 +276,10 @@ function chatReq(body: Record<string, unknown>): Request {
|
||||
|
||||
describe("coach chat — tool-mode routing (F1)", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
// Reset, not clear: cases swap in their own tool loop and parsers, and a
|
||||
// cleared mock would hand those to the next case. Every mock here goes
|
||||
// back to the implementation it was created with.
|
||||
vi.resetAllMocks();
|
||||
reserveBudget.mockResolvedValue({
|
||||
allowed: true,
|
||||
reserved: 3000,
|
||||
|
||||
Reference in new issue
Block a user