Java Lab: refactor and migrate Theater to ts#73345
Merged
Merged
Conversation
molly-moen
commented
Jun 18, 2026
| ) { | ||
| this.canvas = null; | ||
| this.context = null; |
Contributor
Author
There was a problem hiding this comment.
these were not used
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors Java Lab’s Theater mini-app in preparation for Lab2 Java Lab Theater by migrating it to TypeScript, relocating it under apps/src/miniApps/ for shared use, and updating unit tests to Jest.
Changes:
- Migrate Theater implementation to TypeScript and move it to
apps/src/miniApps/theater/. - Update Java Lab to import Theater from the new shared mini-app path.
- Convert Theater unit tests to TypeScript and Jest mocks/assertions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/test/unit/miniApps/theater/TheaterTest.ts | Migrates the Theater unit tests from sinon/chai style to Jest and updates imports to the new Theater location. |
| apps/src/miniApps/theater/Theater.ts | TypeScript migration of Theater, adds typing, and adjusts implementation details for the new shared mini-app location. |
| apps/src/javalab/Javalab.js | Switches Java Lab’s Theater import to the new @cdo/apps/miniApps/theater/Theater path. |
Comments suppressed due to low confidence (3)
apps/src/miniApps/theater/Theater.ts:17
handleSignalassumes certain fields exist (e.g.data.detail.urlfor AUDIO_URL/VISUAL_URL), but theTheaterSignaltype currently allows any stringvalueand makesurloptional. This weakens the TypeScript migration and can silently produce an invalidsrclike"undefined?=..."ifurlis missing. Model the signal as a discriminated union sourlis required for the URL signals anddetailis optional for NO_AUDIO.
apps/src/miniApps/theater/Theater.ts:184XMLHttpRequest.onloadfires for any completed response (including HTTP 4xx/5xx). Assigningxhr.onload = onSuccesswill report upload success even when the server rejected the PUT. Route non-2xx statuses to the error handler (and keeponerrorfor network failures).
apps/test/unit/miniApps/theater/TheaterTest.ts:84- This test previously asserted the audio play function was called exactly once after both media elements loaded.
toHaveBeenCalled()is weaker and would still pass if playback was triggered multiple times; usetoHaveBeenCalledTimes(1)to keep the original intent.
bencodeorg
approved these changes
Jun 18, 2026
| } from './redux/javalabRedux'; | ||
| import javalabView, {setDisplayTheme} from './redux/viewRedux'; | ||
| import Theater from './theater/Theater'; | ||
| import TheaterVisualizationColumn from './theater/TheaterVisualizationColumn'; |
Contributor
There was a problem hiding this comment.
Nit: consistent relative/absolute import for these two in same dir?
Contributor
Author
There was a problem hiding this comment.
they aren't the same directory anymore, the theater visualization column is still in the javalab directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small refactor to prep for lab2 Java Lab theater:
Testing story
Tested there was no impact on existing theater in Java Lab. Theater in Java Lab on lab2 is coming next.