Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 2x 20x 2x 2x 2x 2x 26x 26x 26x 26x | /**
* Shared test utilities for ProjectEditForm tests
*/
import { vi } from "vitest";
import type { Project } from "../../lib/api";
// Mock data for tests
export const mockProject: Project = {
id: "p1",
proId: "v1",
title: "Modern Kitchen Design",
description: "A beautiful modern kitchen",
status: "draft",
sort: 1,
scope: ["design", "material"],
workedAreaIds: ["sc1"],
localityId: "l1",
propertyType: "apartment",
propertySize: "2bhk",
projectAreaSqft: 1200,
budgetRange: "3_5l",
duration: "2 months",
materialTagIds: ["mt1"],
isBeforeAfter: true,
clientTestimonial: "Great work!",
yearCompleted: 2024,
useRooms: false,
defaultRoomId: null,
styleTagIds: null,
isFeatured: true,
dateCreated: new Date().toISOString(),
dateUpdated: new Date().toISOString(),
metaTitle: null,
metaDescription: null,
ogImage: null,
};
// Default props for tests
export function createDefaultProps(overrides = {}) {
return {
project: mockProject,
isSaving: false,
onSubmit: vi.fn(),
...overrides,
};
}
// Location cascade mock functions - used internally by resetMocks
const mockSetLocalityId = vi.fn();
const mockHandleCityChange = vi.fn();
const mockHandleZoneChange = vi.fn();
const mockInitializeFromLocality = vi.fn();
// Helper to reset all mocks
export function resetMocks() {
mockSetLocalityId.mockReset();
mockHandleCityChange.mockReset();
mockHandleZoneChange.mockReset();
mockInitializeFromLocality.mockReset();
}
|