fix(command): combined unknown-target message; cover both go-to summary forms

- UX: unknown-target message now reads "don't know any direction or place
  called '...'" so direction typos (e.g. 'go nroth') make sense
- clarity: resolveVisited uses equalsIgnoreCase for id/name matching;
  add null-world guard comment pointing to CommandTestSupport
- Javadoc: note that 'to' filler word is stripped, making go-to forms equivalent
- tests: assert 'through the Hallway' in 3-node route; update unknown message
  assertion; add adjacentWalkUsesShortSummary covering the n==2 short-form path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 20:23:41 +02:00
parent a30c153de1
commit c01c47a585
2 changed files with 16 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ class GoCommandPathTest {
new GoCommand().execute(ctx, List.of("library"));
assertThat(ctx.getPlayer().getCurrentRoom().getId()).isEqualTo("library");
assertThat(out(ctx)).contains("make your way");
assertThat(out(ctx)).contains("through the Hallway");
}
@Test
@@ -66,7 +67,7 @@ class GoCommandPathTest {
GameContext ctx = world(false, "Library");
new GoCommand().execute(ctx, List.of("dungeon"));
assertThat(ctx.getPlayer().getCurrentRoom().getId()).isEqualTo("kitchen");
assertThat(out(ctx)).contains("don't know any place called 'dungeon'");
assertThat(out(ctx)).contains("don't know any direction or place called 'dungeon'");
}
@Test
@@ -90,4 +91,13 @@ class GoCommandPathTest {
new GoCommand().execute(ctx, List.of("north"));
assertThat(ctx.getPlayer().getCurrentRoom().getId()).isEqualTo("hallway");
}
@Test
void adjacentWalkUsesShortSummary() {
GameContext ctx = world(false, "Library");
new GoCommand().execute(ctx, List.of("hallway"));
assertThat(ctx.getPlayer().getCurrentRoom().getId()).isEqualTo("hallway");
assertThat(out(ctx)).contains("make your way from the Kitchen to the Hallway");
assertThat(out(ctx)).doesNotContain("through");
}
}