Skip to content

fix: workload promote test and status code#439

Open
dimakis wants to merge 1 commit into
mainfrom
fix/workload-broadcast-test
Open

fix: workload promote test and status code#439
dimakis wants to merge 1 commit into
mainfrom
fix/workload-broadcast-test

Conversation

@dimakis

@dimakis dimakis commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix vacuous broadcast test: setWorkloadBroadcast() instead of monkey-patching non-existent app._workloadBroadcast
  • Add missing test for promote with description but no title
  • Return 400 (not 404) when item exists but has no title

Pre-existing issues flagged by Centaur on PR #428.

Test plan

  • workload-routes tests pass (25/25)

🤖 Generated with Claude Code

- Fix vacuous broadcast test: use setWorkloadBroadcast() instead of
  monkey-patching non-existent app._workloadBroadcast property
- Add missing test for promote with description but no title
- Return 400 (not 404) when item exists but has no title

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@dimakis dimakis left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Centaur Review

Found 2 issue(s) (1 warning).

server/__tests__/workload-routes.test.ts

Good fixes — proper use of setWorkloadBroadcast API and correct 400/404 status differentiation — but the new 400 branch (item exists, no title) lacks test coverage.

  • 🟡 missing_tests: The code change introduces a new 400 status path (item exists in workloadStore but has no title), but there's no test covering it. The new test only covers the 404 path (missing item). Add a test that creates an item with an empty-string title, then promotes it without providing a body title, and asserts 400 with 'No title provided'. [fixable]
  • 🔵 style (L570): The reset comment '// Reset — no broadcast callback in test environment' explains what the line does, not why. The code setWorkloadBroadcast(() => {}) is self-explanatory. Per project conventions, this comment should be removed. [fixable]

expect(workloadBroadcasts).toHaveLength(0);

(app as any)._workloadBroadcast = origBroadcast;
// Reset — no broadcast callback in test environment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 style: The reset comment '// Reset — no broadcast callback in test environment' explains what the line does, not why. The code setWorkloadBroadcast(() => {}) is self-explanatory. Per project conventions, this comment should be removed. [fixable]

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.

1 participant