29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { buildPageTitle, getAppName } from '../appTitle';
|
|
|
|
describe('app title helpers', () => {
|
|
it('falls back to Fotospiel when VITE_APP_NAME is missing', () => {
|
|
const original = import.meta.env.VITE_APP_NAME;
|
|
// @ts-expect-error - import.meta.env is mutable in vitest
|
|
import.meta.env.VITE_APP_NAME = '';
|
|
|
|
expect(getAppName()).toBe('Fotospiel');
|
|
expect(buildPageTitle('Demo')).toBe('Demo - Fotospiel');
|
|
|
|
// @ts-expect-error - restore original value
|
|
import.meta.env.VITE_APP_NAME = original;
|
|
});
|
|
|
|
it('uses the configured VITE_APP_NAME when available', () => {
|
|
const original = import.meta.env.VITE_APP_NAME;
|
|
// @ts-expect-error - import.meta.env is mutable in vitest
|
|
import.meta.env.VITE_APP_NAME = 'Fotospiel App';
|
|
|
|
expect(getAppName()).toBe('Fotospiel App');
|
|
expect(buildPageTitle('Demo')).toBe('Demo - Fotospiel App');
|
|
|
|
// @ts-expect-error - restore original value
|
|
import.meta.env.VITE_APP_NAME = original;
|
|
});
|
|
});
|