Skip to content

Add named scenarios to Context for flexible test state setup#12

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-scenario-sample-data
Draft

Add named scenarios to Context for flexible test state setup#12
Copilot wants to merge 2 commits into
mainfrom
copilot/add-scenario-sample-data

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

The Context class had its initial sample data hardcoded inline, with no way to switch between different pre-defined states at runtime.

Changes

  • Extracted hardcoded data into a startup scenario — initial pets/users/orders now live in a top-level SCENARIOS constant; constructor calls this.loadScenario("startup") instead of inlining data
  • Added three additional scenarios:
    • empty — no data; clean slate for building state from scratch
    • sold-out — all pets status: "sold", all orders complete: true
    • busy — 8 pets with mixed statuses, 3 users, 4 orders
  • loadScenario(name) — replaces all context data and resets ID counters; callable from the REPL:
    ⬣> context.loadScenario("sold-out")
    ⬣> context.loadScenario("empty")
    
  • context.scenarios getter — returns available scenario names for discovery in the REPL
  • Scenarios deep-copy data on load so mutations between loads don't bleed through

Copilot AI linked an issue Apr 28, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add startup and additional scenarios with sample data Add named scenarios to Context for flexible test state setup Apr 28, 2026
Copilot AI requested a review from pmcelhaney April 28, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scenarios

2 participants