- built-in mock Gitea backend (src/core/demo): repositories, issues, comments, reactions, labels/milestones, pulls, files, diff, reviews, inline comments, releases, notifications, activity, Actions runs/jobs/logs/artifacts/workflows, repo settings, orgs/teams/packages/credentials/admin, and benign writes - session wires demoFetch for the demo instance; welcome screen 'Try the demo' - demo E2E (16 tests over the real endpoint layer) + UI render E2E; minimal reanimated jest mock; README demo-mode section
24 lines
779 B
TypeScript
24 lines
779 B
TypeScript
/**
|
|
* Demo mode helpers.
|
|
*
|
|
* Starting the demo registers a local instance whose API calls are served by
|
|
* {@link demoFetch} — no network and no credentials required.
|
|
*/
|
|
|
|
import { useAccountsStore } from '@/core/accounts/accounts-store';
|
|
|
|
import { DEMO_BASE_URL, DEMO_LOGIN, DEMO_TOKEN } from './demo-fetch';
|
|
|
|
export { demoFetch, isDemoBaseUrl, DEMO_BASE_URL, DEMO_HOST, DEMO_TOKEN, DEMO_LOGIN } from './demo-fetch';
|
|
|
|
/** Registers the built-in demo instance and makes it the active account. */
|
|
export async function startDemoAccount(): Promise<void> {
|
|
await useAccountsStore.getState().registerAccount({
|
|
baseUrl: DEMO_BASE_URL,
|
|
label: 'Demo',
|
|
token: DEMO_TOKEN,
|
|
version: '1.22.0',
|
|
profile: { login: DEMO_LOGIN, id: 1, fullName: 'Octo Cat' },
|
|
});
|
|
}
|