fix test failure
Test / Type Check (all packages) (push) Successful in 3m30s
Test / API Unit Tests (push) Successful in 3m5s
Test / Homepage Unit Tests (push) Successful in 3m0s
Test / Storefront Unit Tests (push) Successful in 3m36s
Test / Admin Unit Tests (push) Successful in 4m0s
Test / Dashboard Unit Tests (push) Successful in 3m11s
Test / API Integration Tests (push) Successful in 3m6s
Build & Deploy / Build & Push Docker Image (push) Failing after 14s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / Type Check (all packages) (push) Successful in 3m30s
Test / API Unit Tests (push) Successful in 3m5s
Test / Homepage Unit Tests (push) Successful in 3m0s
Test / Storefront Unit Tests (push) Successful in 3m36s
Test / Admin Unit Tests (push) Successful in 4m0s
Test / Dashboard Unit Tests (push) Successful in 3m11s
Test / API Integration Tests (push) Successful in 3m6s
Build & Deploy / Build & Push Docker Image (push) Failing after 14s
Build & Deploy / Deploy to VPS (push) Has been skipped
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
vi.mock('../../lib/storage', () => ({ uploadImage: vi.fn().mockResolvedValue('/storage/companies/company_1/brand/logo.jpg') }))
|
||||
vi.mock('./settingsEntitlements', () => ({
|
||||
resolveSettingsEntitlements: vi.fn(),
|
||||
}))
|
||||
vi.mock('./company.repo', () => ({
|
||||
findCompany: vi.fn(),
|
||||
updateCompany: vi.fn(),
|
||||
@@ -28,8 +31,43 @@ vi.mock('./company.repo', () => ({
|
||||
}))
|
||||
|
||||
const repo = await import('./company.repo')
|
||||
const entitlements = await import('./settingsEntitlements')
|
||||
const service = await import('./company.service')
|
||||
|
||||
const editableSettingsFeatures = [
|
||||
'settings.company_profile',
|
||||
'settings.public_contact',
|
||||
'settings.locale_currency',
|
||||
'settings.storefront_listing',
|
||||
'settings.branding_basic',
|
||||
'settings.branding_custom',
|
||||
'settings.branding_hero',
|
||||
'settings.renter_payments',
|
||||
'settings.rental_policies_basic',
|
||||
'settings.additional_driver_fees',
|
||||
'settings.insurance_policies',
|
||||
'settings.pricing_rules',
|
||||
'settings.accounting_defaults',
|
||||
'settings.accounting_scheduled_delivery',
|
||||
'settings.accounting_advanced_formats',
|
||||
] as const
|
||||
|
||||
function buildEditableEntitlements() {
|
||||
return {
|
||||
plan: 'PRO',
|
||||
subscriptionStatus: 'ACTIVE',
|
||||
currentPeriodEnd: null,
|
||||
trialEndAt: null,
|
||||
accessLevel: 'full',
|
||||
features: Object.fromEntries(editableSettingsFeatures.map((featureKey) => [featureKey, {
|
||||
available: true,
|
||||
editable: true,
|
||||
requiredPlan: null,
|
||||
reason: null,
|
||||
}])),
|
||||
}
|
||||
}
|
||||
|
||||
const currentBrand = {
|
||||
id: 'brand_1',
|
||||
companyId: 'company_1',
|
||||
@@ -44,6 +82,7 @@ const currentBrand = {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
vi.mocked(entitlements.resolveSettingsEntitlements).mockResolvedValue(buildEditableEntitlements() as any)
|
||||
delete process.env.NEXT_PUBLIC_CUSTOM_DOMAIN_TARGET
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user