Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
70 lines
3.1 KiB
TypeScript
70 lines
3.1 KiB
TypeScript
// @vitest-environment node
|
|
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
function read(relativePath: string): string {
|
|
return fs.readFileSync(path.resolve(__dirname, relativePath), 'utf8');
|
|
}
|
|
|
|
function readJson<T>(relativePath: string): T {
|
|
return JSON.parse(read(relativePath)) as T;
|
|
}
|
|
|
|
function getLeaf(record: Record<string, unknown>, dottedPath: string): unknown {
|
|
return dottedPath.split('.').reduce<unknown>((value, key) => {
|
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
return undefined;
|
|
}
|
|
return (value as Record<string, unknown>)[key];
|
|
}, record);
|
|
}
|
|
|
|
const expectedLabelKeys: Array<{ value: string; labelKey: string }> = [
|
|
{ value: 'quotes', labelKey: 'dashboard.tabs.quotes' },
|
|
{ value: 'quote-templates', labelKey: 'dashboard.tabs.quoteLayouts' },
|
|
{ value: 'quote-business-templates', labelKey: 'dashboard.tabs.quoteTemplates' },
|
|
{ value: 'client-contracts', labelKey: 'dashboard.tabs.clientContracts' },
|
|
{ value: 'accounting-exports', labelKey: 'dashboard.tabs.accountingExports' },
|
|
{ value: 'contract-templates', labelKey: 'dashboard.tabs.contractTemplates' },
|
|
{ value: 'invoicing', labelKey: 'dashboard.tabs.invoicing' },
|
|
{ value: 'invoice-templates', labelKey: 'dashboard.tabs.invoiceLayouts' },
|
|
{ value: 'tax-rates', labelKey: 'dashboard.tabs.taxRates' },
|
|
{ value: 'contract-lines', labelKey: 'dashboard.tabs.contractLinePresets' },
|
|
{ value: 'billing-cycles', labelKey: 'dashboard.tabs.billingCycles' },
|
|
{ value: 'service-periods', labelKey: 'dashboard.tabs.servicePeriods' },
|
|
{ value: 'usage-tracking', labelKey: 'dashboard.tabs.usageTracking' },
|
|
{ value: 'reports', labelKey: 'dashboard.tabs.reports' },
|
|
{ value: 'service-catalog', labelKey: 'dashboard.tabs.serviceCatalog' },
|
|
{ value: 'products', labelKey: 'dashboard.tabs.products' },
|
|
];
|
|
|
|
describe('billingTabsConfig i18n wiring contract', () => {
|
|
it('T031: every tab definition carries a labelKey and BillingDashboard resolves it via t(tab.labelKey, { defaultValue: tab.label })', () => {
|
|
const configSource = read('../../src/components/billing-dashboard/billingTabsConfig.ts');
|
|
const dashboardSource = read('../../src/components/billing-dashboard/BillingDashboard.tsx');
|
|
|
|
for (const { value, labelKey } of expectedLabelKeys) {
|
|
// Each definition block mentions both its value and its labelKey
|
|
expect(configSource).toContain(`value: '${value}'`);
|
|
expect(configSource).toContain(`labelKey: '${labelKey}'`);
|
|
}
|
|
|
|
// BillingDashboard consumes the labelKey via t()
|
|
expect(dashboardSource).toContain('label: t(tab.labelKey, { defaultValue: tab.label })');
|
|
});
|
|
|
|
it('T032: all 16 tab labels are present in the de locale (dashboard.tabs.*)', () => {
|
|
const deLocale = readJson<Record<string, unknown>>(
|
|
'../../../../server/public/locales/de/msp/billing.json'
|
|
);
|
|
|
|
for (const { labelKey } of expectedLabelKeys) {
|
|
const value = getLeaf(deLocale, labelKey);
|
|
expect(typeof value, `${labelKey} should be a non-empty string in de locale`).toBe('string');
|
|
expect((value as string).length).toBeGreaterThan(0);
|
|
}
|
|
});
|
|
});
|