Add unit tests for the virtual campus layout logic

Open Beginner friendly
#1,150 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
Half a day
Newbie friendliness
82/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript, vite
Domain
testing

Research direction

Start by reading selectForCampus and normalize in virtual/src/data/activities.ts, then layoutRows in virtual/src/world/kiosks.ts and footprint in virtual/src/world/campus.ts. Check virtual/package.json and the Vite config to see how Vitest would be wired in. Done means npm test runs at least 10 passing tests covering live-first sorting, waitlist ordering, the 40-item hall cap, the study cap of 8, and rotated footprint bounds, and npm run build still passes.

Written by the indexing model from the issue text.

Description

2026-11 good first issue gsoc-2027 project: virtual tests
Context

The virtual campus (virtual/, TypeScript + Vite) has no tests and no test script in package.json. The logic that decides what appears in the world is pure and easy to test:

  • selectForCampus(all, hallCap = 40, studyCap = 8) in virtual/src/data/activities.ts (~line 195): filtering, priority sort, and the 40-item hall budget across groups.
  • normalize() and the slug helper (~line 158) in the same file.
  • layoutRows() in virtual/src/world/kiosks.ts (~line 27) and footprint() in virtual/src/world/campus.ts (~line 106).
What to do
  • Add Vitest as a dev dependency (it reuses the existing Vite config) and add an npm test script.
  • Write tests for the functions above, including: live items sort first, waitlist items appear only after published ones, the hall cap is respected across groups, study groups are capped at 8, and a rotated footprint has correct bounds.
  • Make sure npm run build still passes (tsc must ignore or include test files correctly).
Acceptance criteria
  • npm test passes in virtual/ with at least 10 tests.
  • npm run build still succeeds.
  • README documents npm test.
Files
  • virtual/package.json
  • virtual/src/data/activities.ts
  • virtual/src/world/kiosks.ts
  • virtual/src/world/campus.ts
  • virtual/src/**/*.test.ts (new)
  • virtual/README.md
Helpful links

Part of GSoC 2027 onboarding — see https://gsoc.alphaonelabs.com

Dominant language
HTML
Stars
66
Forks
181
Avg merge
2m
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from alphaonelabs/website

All issues in alphaonelabs/website

Similar issues

More Testing & QA issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.