-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
About the Contributor
Type of Contribution
This is a Bug fix
Current Behavior
main is failing CI.
New Behavior
Fix main.
Move all deletion tests to the end of the test suite to prevent cascading failures. Previously, deletion tests were interspersed throughout, causing subsequent tests to fail when trying to access deleted resources (playlists, rundowns, segments, parts).
Also add null check for newIngestPart before accessing its properties.
Testing
- I have added one or more unit tests for this PR
- I have updated the relevant unit tests
- No unit test changes are needed for this PR
Affected areas
Time Frame
Other Information
Status
- PR is ready to be reviewed.
- The functionality has been tested by the author.
- Relevant unit tests has been added / updated.
- Relevant documentation (code comments, system documentation) has been added / updated.
Summary
This PR reorders the OpenAPI ingest test suite to prevent test failures caused by later tests attempting to access resources that have been deleted. All deletion-related tests (for playlists, rundowns, segments, and parts) have been moved to a consolidated section at the end of the test file. Additionally, a null check has been added to guard against accessing properties on newIngestPart before it's validated.
Changes
File: packages/openapi/src/__tests__/ingest.spec.ts
-
Consolidated all deletion tests into a single "DELETIONS" block at the end of the test suite, including:
- Playlist deletion tests (delete-by-id and bulk-delete)
- Rundown deletion tests
- Segment deletion tests
- Part deletion tests
-
Added a null/undefined check for
newIngestPartbefore accessing its properties during part update operations -
Test semantics and expected outcomes remain unchanged; only execution order has been modified
Statistics
- Lines changed: +52/-47
- Single file modified
- No changes to public APIs or method signatures
cascading failures. Previously, deletion tests were interspersed
throughout, causing subsequent tests to fail when trying to access
deleted resources (playlists, rundowns, segments, parts).
Also add null check for newIngestPart before accessing its properties.
WalkthroughTest file refactoring that consolidates deletion-related tests into a dedicated block at the end of the test suite and adds a defensive guard check to verify object existence before mutation during part updates. Changes
Estimated code review effort2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks | 3Passed checks (3 passed)
Tip: You can configure your own custom pre-merge checks in the settings. Finishing touches
Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov ReportAll modified and coverable lines are covered by tests. Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick comments (1)
packages/openapi/src/__tests__/ingest.spec.ts (1)
356-388:newIngestPartmutation is unused -- theputPartcall uses a hardcoded literal.The guard at lines 358-360 is a good defensive addition, but note that
newIngestPart.nameis mutated and then never referenced again -- the API call on line 361 passes a hardcoded part object (externalId: 'part1',name: 'Part 1', etc.), notnewIngestPart. This makes the entireifblock dead code. Was the intent to passnewIngestPart(or its modified name) into theputPartcall?Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/openapi/src/__tests__/ingest.spec.ts` around lines 356 - 388, The
test contains dead code: the conditional mutates newIngestPart.name but the
ingestApi.putPart call passes a hardcoded part object, so the mutation is never
used; either remove the unused if-block or change the putPart invocation in the
'Can update a part' test to pass the modified newIngestPart (or a copy with the
updated name) as the part parameter instead of the hardcoded literal; update
references to newIngestPart and ingestApi.putPart accordingly so the mutated
name is actually sent to the API.
Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/openapi/src/__tests__/ingest.spec.ts`:
- Around line 356-388: The test contains dead code: the conditional mutates
newIngestPart.name but the ingestApi.putPart call passes a hardcoded part
object, so the mutation is never used; either remove the unused if-block or
change the putPart invocation in the 'Can update a part' test to pass the
modified newIngestPart (or a copy with the updated name) as the part parameter
instead of the hardcoded literal; update references to newIngestPart and
ingestApi.putPart accordingly so the mutated name is actually sent to the API.
Quality Gate passedIssues Measures |