all the haul
This commit is contained in:
+38
-16
@@ -50,7 +50,7 @@ mock.module("../src/managers/sessions", () => ({
|
||||
Promise.resolve({
|
||||
accessToken: "mock-access",
|
||||
refreshToken: "mock-refresh",
|
||||
}),
|
||||
})
|
||||
),
|
||||
fetch: mock(() => Promise.resolve(null)),
|
||||
},
|
||||
@@ -93,6 +93,14 @@ mock.module("../src/constants", () => ({
|
||||
unifiPassword: "test-pass",
|
||||
io: { of: mock(() => ({ on: mock() })) },
|
||||
engine: {},
|
||||
collectorSocket: {
|
||||
connected: false,
|
||||
connect: mock(),
|
||||
disconnect: mock(),
|
||||
on: mock(),
|
||||
emit: mock(),
|
||||
},
|
||||
connectCollectorSocket: mock(),
|
||||
}));
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -108,7 +116,7 @@ mock.module("../src/constants", () => ({
|
||||
* never encounter "export not found" errors.
|
||||
*/
|
||||
export function buildMockConstants(
|
||||
overrides: Record<string, any> = {},
|
||||
overrides: Record<string, any> = {}
|
||||
): Record<string, any> {
|
||||
return {
|
||||
prisma: createMockPrisma(),
|
||||
@@ -142,6 +150,14 @@ export function buildMockConstants(
|
||||
unifiPassword: "test-pass",
|
||||
io: { of: mock(() => ({ on: mock() })) },
|
||||
engine: {},
|
||||
collectorSocket: {
|
||||
connected: false,
|
||||
connect: mock(),
|
||||
disconnect: mock(),
|
||||
on: mock(),
|
||||
emit: mock(),
|
||||
},
|
||||
connectCollectorSocket: mock(),
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
@@ -152,7 +168,7 @@ export function buildMockConstants(
|
||||
* never encounter "export not found" errors.
|
||||
*/
|
||||
export function buildMockGlobalEvents(
|
||||
overrides: Record<string, any> = {},
|
||||
overrides: Record<string, any> = {}
|
||||
): Record<string, any> {
|
||||
return {
|
||||
events: {
|
||||
@@ -175,7 +191,7 @@ export function createMockPrisma() {
|
||||
get(_target, prop) {
|
||||
return mock(() => Promise.resolve(null));
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return new Proxy(
|
||||
@@ -186,7 +202,7 @@ export function createMockPrisma() {
|
||||
return mock(() => Promise.resolve());
|
||||
return createModelProxy();
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -200,7 +216,7 @@ export function createMockUnifi() {
|
||||
updateWlanConf: mock(() => Promise.resolve({})),
|
||||
getNetworks: mock(() => Promise.resolve([])),
|
||||
createSite: mock(() =>
|
||||
Promise.resolve({ name: "default", description: "Default" }),
|
||||
Promise.resolve({ name: "default", description: "Default" })
|
||||
),
|
||||
getWlanGroups: mock(() => Promise.resolve([])),
|
||||
createWlanGroup: mock(() => Promise.resolve({})),
|
||||
@@ -252,10 +268,13 @@ export function buildMockRole(overrides: Record<string, any> = {}) {
|
||||
/** Build a minimal Prisma-shaped Company row. */
|
||||
export function buildMockCompany(overrides: Record<string, any> = {}) {
|
||||
return {
|
||||
id: "company-1",
|
||||
id: 123,
|
||||
uid: "company-1",
|
||||
name: "Test Company",
|
||||
cw_Identifier: "TestCo",
|
||||
cw_CompanyId: 123,
|
||||
phone: "555-1234",
|
||||
website: "https://test.com",
|
||||
contacts: [],
|
||||
companyAddresses: [],
|
||||
createdAt: new Date("2025-01-01"),
|
||||
updatedAt: new Date("2025-01-01"),
|
||||
...overrides,
|
||||
@@ -354,16 +373,16 @@ export function buildMockUnifiSite(overrides: Record<string, any> = {}) {
|
||||
/** Build a minimal Prisma-shaped Opportunity row. */
|
||||
export function buildMockOpportunity(overrides: Record<string, any> = {}) {
|
||||
return {
|
||||
id: "opp-1",
|
||||
cwOpportunityId: 1001,
|
||||
uid: "opp-1",
|
||||
id: 1001,
|
||||
name: "Test Opportunity",
|
||||
notes: "Some notes",
|
||||
typeName: "New Business",
|
||||
typeCwId: 1,
|
||||
typeId: 1,
|
||||
type: { id: 1, name: "New Business" },
|
||||
stageName: "Proposal",
|
||||
stageCwId: 2,
|
||||
statusName: "Active",
|
||||
statusCwId: 3,
|
||||
statusId: 3,
|
||||
status: { id: 3, name: "Active" },
|
||||
priorityName: "High",
|
||||
priorityCwId: 4,
|
||||
ratingName: "Hot",
|
||||
@@ -379,12 +398,14 @@ export function buildMockOpportunity(overrides: Record<string, any> = {}) {
|
||||
secondarySalesRepCwId: null,
|
||||
companyCwId: 123,
|
||||
companyName: "Test Company",
|
||||
companyId: "company-1",
|
||||
contactCwId: 200,
|
||||
contactName: "Jane Doe",
|
||||
siteCwId: 300,
|
||||
siteName: "Main Office",
|
||||
customerPO: "PO-12345",
|
||||
totalSalesTax: 50.0,
|
||||
probability: 80,
|
||||
locationName: "HQ",
|
||||
locationCwId: 400,
|
||||
departmentName: "Sales",
|
||||
@@ -396,8 +417,9 @@ export function buildMockOpportunity(overrides: Record<string, any> = {}) {
|
||||
closedFlag: false,
|
||||
closedByName: null,
|
||||
closedByCwId: null,
|
||||
companyId: "company-1",
|
||||
cwLastUpdated: new Date("2026-02-28"),
|
||||
cwDateEntered: new Date("2026-01-01"),
|
||||
productSequence: [],
|
||||
createdAt: new Date("2026-01-01"),
|
||||
updatedAt: new Date("2026-02-28"),
|
||||
company: null,
|
||||
|
||||
Reference in New Issue
Block a user