fix: correct test mock paths from "./db" to "../db"
Fixes incorrect vi.mock paths that were causing tests to fail. The mock path should match the import path in the route files. This addresses the authProvider test mock path issue on PR #2. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -5,7 +5,7 @@ let dbSelectResult: unknown[] = [];
|
|||||||
const mockEq = vi.fn((_col: unknown, _val: unknown) => ({ col: _col, val: _val }));
|
const mockEq = vi.fn((_col: unknown, _val: unknown) => ({ col: _col, val: _val }));
|
||||||
const mockDecryptSecret = vi.fn((s: string) => `decrypted:${s}`);
|
const mockDecryptSecret = vi.fn((s: string) => `decrypted:${s}`);
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
const authProviderConfig = new Proxy(
|
const authProviderConfig = new Proxy(
|
||||||
{ _name: "auth_provider_config" },
|
{ _name: "auth_provider_config" },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const mockGroomer: MockStaff = { id: "staff-3", role: "groomer", isSuperUser: fa
|
|||||||
|
|
||||||
// ─── Mock db module ───────────────────────────────────────────────────────────
|
// ─── Mock db module ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
const authProviderConfig = new Proxy(
|
const authProviderConfig = new Proxy(
|
||||||
{ _name: "auth_provider_config" },
|
{ _name: "auth_provider_config" },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function resetMock() {
|
|||||||
deletedId = null;
|
deletedId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
function makeChainable(data: unknown[]): unknown {
|
function makeChainable(data: unknown[]): unknown {
|
||||||
const arr = [...data];
|
const arr = [...data];
|
||||||
const chain = new Proxy(arr, {
|
const chain = new Proxy(arr, {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function resetMock() {
|
|||||||
lastUpdate = {};
|
lastUpdate = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
const appointments = new Proxy(
|
const appointments = new Proxy(
|
||||||
{ _name: "appointments" },
|
{ _name: "appointments" },
|
||||||
{ get: (t, p) => (p === "_name" ? "appointments" : { table: "appointments", column: p }) }
|
{ get: (t, p) => (p === "_name" ? "appointments" : { table: "appointments", column: p }) }
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function makeChainableResult(data: unknown[]): unknown {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
function makeTable(name: string) {
|
function makeTable(name: string) {
|
||||||
return new Proxy(
|
return new Proxy(
|
||||||
{ _name: name },
|
{ _name: name },
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function resetDb() {
|
|||||||
|
|
||||||
// ─── Module mocks ─────────────────────────────────────────────────────────────
|
// ─── Module mocks ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
const pets = new Proxy(
|
const pets = new Proxy(
|
||||||
{ _name: "pets" },
|
{ _name: "pets" },
|
||||||
{ get(t, p) { return p === "_name" ? "pets" : {}; } }
|
{ get(t, p) { return p === "_name" ? "pets" : {}; } }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function resetMock() {
|
|||||||
updatedValues = [];
|
updatedValues = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
function makeChainable(data: unknown[]): unknown {
|
function makeChainable(data: unknown[]): unknown {
|
||||||
const arr = [...data];
|
const arr = [...data];
|
||||||
const chain = new Proxy(arr, {
|
const chain = new Proxy(arr, {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const GROOMER: StaffRow = {
|
|||||||
let staffLookupResult: StaffRow | null = null;
|
let staffLookupResult: StaffRow | null = null;
|
||||||
let managerFallbackResult: StaffRow | null = MANAGER;
|
let managerFallbackResult: StaffRow | null = MANAGER;
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
const staff = new Proxy(
|
const staff = new Proxy(
|
||||||
{ _name: "staff" },
|
{ _name: "staff" },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const PET_ROW = {
|
|||||||
let clientResults: typeof ACTIVE_CLIENT[] = [];
|
let clientResults: typeof ACTIVE_CLIENT[] = [];
|
||||||
let petResults: typeof PET_ROW[] = [];
|
let petResults: typeof PET_ROW[] = [];
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
// Proxy objects for table/column references — values don't matter for tests
|
// Proxy objects for table/column references — values don't matter for tests
|
||||||
const tableProxy = (name: string) =>
|
const tableProxy = (name: string) =>
|
||||||
new Proxy(
|
new Proxy(
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function clearAuthEnv() {
|
|||||||
|
|
||||||
// ─── Mock db module ───────────────────────────────────────────────────────────
|
// ─── Mock db module ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
const authProviderConfig = new Proxy(
|
const authProviderConfig = new Proxy(
|
||||||
{ _name: "auth_provider_config" },
|
{ _name: "auth_provider_config" },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function resetMock() {
|
|||||||
updatedValues = [];
|
updatedValues = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.mock("./db", () => {
|
vi.mock("../db", () => {
|
||||||
function makeChainable(data: unknown[]): unknown {
|
function makeChainable(data: unknown[]): unknown {
|
||||||
const arr = [...data];
|
const arr = [...data];
|
||||||
const chain = new Proxy(arr, {
|
const chain = new Proxy(arr, {
|
||||||
|
|||||||
Reference in New Issue
Block a user