Fix demo task readiness and gate event creation
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-02-05 11:26:07 +01:00
parent 7262617897
commit 04c399aeb6
14 changed files with 318 additions and 36 deletions

View File

@@ -0,0 +1,28 @@
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;
});
});

View File

@@ -0,0 +1,8 @@
export function getAppName(): string {
return import.meta.env.VITE_APP_NAME || 'Fotospiel';
}
export function buildPageTitle(title?: string): string {
const appName = getAppName();
return title ? `${title} - ${appName}` : appName;
}