Files
ashen-realms/apps/web/src/app/core/resume-combat.spec.ts
Bastian Wagner 1322285b0f fix: close out remaining German player-facing text across web and API tests
Repo-wide grep sweep (apps/web/src, apps/api/src) for leftover German
content strings missed by Tasks 1-9, mostly in spec fixtures/assertions
that mirror already-translated seed content (monster/item names, POI
titles and action labels, location names/descriptions) plus a few real
source-file gaps:

- inventory-detail-panel.component.ts: STAT_LABELS (Waffenschaden,
  Angriff, Leben, Rüstung) were never translated by Task 6; now match
  the identical English labels already used in inventory-page.component.html.
- app-shell.component.html: aria-label="Spielinhalt" -> "Game content"
  (this file was outside every prior task's file list).
- location-interaction-panel.component.spec.ts: dead NPC-quote fixture
  translated to match the real wounded-scout POI text.

Code comments referencing German source-spec section titles or
not-yet-seeded faction names, and inline calculation-documentation
comments, are left as-is per the source spec's scope (dev-facing
comments may stay German).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ACkMEDYiwtcfchqKkiUJNX
2026-08-21 22:59:34 +02:00

69 lines
2.0 KiB
TypeScript

import { TestBed } from '@angular/core/testing';
import { Router, provideRouter } from '@angular/router';
import { vi } from 'vitest';
import type { Combat } from './api/game-api.models';
import { App } from '../app';
import { CombatStore } from '../features/combat/combat.store';
const runningCombat: Combat = {
id: 'combat-running',
status: 'ACTIVE',
round: 4,
player: { name: 'Aric Duskwalker', maxHp: 100, currentHp: 62, potionsRemaining: 2, potionsMax: 2 },
monster: {
key: 'road-bandit',
name: 'Road Bandit',
level: 3,
maxHp: 75,
currentHp: 30,
artworkPath: '/images/enemies/RoadBandit.png',
pendingIntent: null,
},
events: [],
rewards: null,
};
describe('resuming an interrupted combat', () => {
let combatStore: { loadActiveCombat: ReturnType<typeof vi.fn> };
let router: Router;
async function bootstrap() {
await TestBed.configureTestingModule({
imports: [App],
providers: [
provideRouter([
{ path: 'world', children: [] },
{ path: 'combat/:combatId', children: [] },
]),
{ provide: CombatStore, useValue: combatStore },
],
}).compileComponents();
router = TestBed.inject(Router);
vi.spyOn(router, 'navigate').mockResolvedValue(true);
const fixture = TestBed.createComponent(App);
fixture.detectChanges();
await fixture.whenStable();
return fixture;
}
it('drops the player straight back into the fight they left running', async () => {
combatStore = { loadActiveCombat: vi.fn(() => Promise.resolve(runningCombat)) };
await bootstrap();
expect(combatStore.loadActiveCombat).toHaveBeenCalledOnce();
expect(router.navigate).toHaveBeenCalledWith(['/combat', 'combat-running']);
});
it('leaves navigation alone when no fight is running', async () => {
combatStore = { loadActiveCombat: vi.fn(() => Promise.resolve(null)) };
await bootstrap();
expect(combatStore.loadActiveCombat).toHaveBeenCalledOnce();
expect(router.navigate).not.toHaveBeenCalled();
});
});