Build user pages
This commit is contained in:
@@ -54,3 +54,85 @@ export function mockUserWithProfile(overrides?: Record<string, unknown>) {
|
||||
...overrides
|
||||
});
|
||||
}
|
||||
|
||||
/** User with profile that includes addresses. */
|
||||
export function mockUserWithProfileAndAddresses(overrides?: Record<string, unknown>) {
|
||||
return mockUser({
|
||||
profile: {
|
||||
id: 'profile-1',
|
||||
userId: 'user-1',
|
||||
firstName: 'Jane',
|
||||
lastName: 'Doe',
|
||||
phoneNumber: '5550100',
|
||||
addresses: [
|
||||
{
|
||||
id: 'addr-1',
|
||||
profileId: 'profile-1',
|
||||
street: '123 Main St',
|
||||
city: 'Dallas',
|
||||
state: 'TX',
|
||||
postalCode: '75001',
|
||||
country: 'US'
|
||||
}
|
||||
]
|
||||
},
|
||||
...overrides
|
||||
});
|
||||
}
|
||||
|
||||
/** Minimal license key object. */
|
||||
export function mockLicenseKey(overrides?: Record<string, unknown>) {
|
||||
return {
|
||||
id: 'key-1',
|
||||
key: 'AAAA-BBBB-CCCC-DDDD',
|
||||
active: true,
|
||||
level: 'standard',
|
||||
userId: 'user-1',
|
||||
...overrides
|
||||
};
|
||||
}
|
||||
|
||||
/** Minimal proclamation object with relations. */
|
||||
export function mockProclamation(overrides?: Record<string, unknown>) {
|
||||
return {
|
||||
id: 'proc-1',
|
||||
name: 'Test Proclamation',
|
||||
content: '<p>Test content</p>',
|
||||
solfeggioFrequencyId: 1,
|
||||
categoryId: 1,
|
||||
price: 0.99,
|
||||
solfeggioFrequency: {
|
||||
id: 1,
|
||||
name: 'UT',
|
||||
value: 396
|
||||
},
|
||||
category: {
|
||||
id: 1,
|
||||
name: 'Healing',
|
||||
parentId: null,
|
||||
parent: null
|
||||
},
|
||||
...overrides
|
||||
};
|
||||
}
|
||||
|
||||
/** Minimal proclamation category. */
|
||||
export function mockCategory(overrides?: Record<string, unknown>) {
|
||||
return {
|
||||
id: 1,
|
||||
name: 'Healing',
|
||||
parentId: null,
|
||||
...overrides
|
||||
};
|
||||
}
|
||||
|
||||
/** Build a URL object for use with PageServerLoad. */
|
||||
export function createUrl(path: string, params?: Record<string, string>): URL {
|
||||
const url = new URL(path, 'http://localhost');
|
||||
if (params) {
|
||||
for (const [k, v] of Object.entries(params)) {
|
||||
url.searchParams.set(k, v);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user