mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
10 KiB
10 KiB
Slides CLI E2E Coverage
Metrics
- Denominator: 7 leaf commands
- Covered: 7
- Coverage: 100%
Summary
- TestSlides_CreateWorkflowAsUser: proves the user slides workflow through
create presentation with slide as userandget created presentation xml as user; creates a fresh presentation, asserts returned IDs, then reads back the XML content to prove the title and slide body persisted. - TestSlidesCreateRepeatedSlideFileDryRunE2E / TestSlidesCreateSlidesFileAndStdinDryRunE2E / TestSlidesCreateRejectsBothSlideFormsDryRunE2E: cover the
+createfile inputs through the built binary, which is the only layer that can prove the point of the feature — a multi-line, quote-heavy page reachesslide.contentbyte-for-byte with no JSON encoder in the caller's hands, and repeated--slideorder is page order. The refusal case pins the exit-2 envelope (param: "--slide") that an agent parses to repair its own command; the package test never runs the dispatcher and so cannot see it. - TestSlidesAddSlideDryRunE2E / TestSlidesDeleteSlideDryRunE2E: pin the request shapes the unit tests cover, but through the real binary, which is the only layer that proves a full
<slide>XML document survives flag parsing with its quotes and angle brackets intact. Delete additionally proves the shortcut runs without--yes, unlike the high-risk-write raw command. - TestSlides_SlideAddDeleteWorkflowAsUser: live add/delete round trip on a throwaway presentation created and torn down per run. Asserts against a readback rather than the write's own response, so it proves what the request shape cannot: the returned
slide_idaddresses a real page,--before-slide-idpositions the page between its neighbours instead of merely being forwarded, and the deleted page is gone while both neighbours survive. - TestSlidesUpdateSlideDryRunE2E / TestSlidesUpdateAliasDryRunE2E / TestSlidesUpdateSlideRefuses*DryRunE2E: dry-run coverage for
+update-slidethrough the built binary — one request carrying oneblock_replacepart whoseblock_idis the PAGE id (the whole design; an element id there would replace one element and leave the rest of the page), theslideservice alias /+updatecommand alias /--xmlspelling, and the two refusals that must not produce a request (a bare element root, and a root id naming a different page). - TestSlidesUpdateSlideLiveE2E: required live-backend assertion for
+update-slide; creates a throwaway presentation with the lane's bot credential, replaces its page using the returned page id asblock_id, reads that page back through+xml-get, verifies the new marker replaced the old marker without changingslide_id, and self-cleans. - TestSlides_HistoryWorkflow: opt-in live round-trip coverage for
+update-slide; creates a presentation, updates its page in place, asserts the returnedslide_id, the persisted marker, and that an element written back with its original id keeps that id, then reverts through slide history and self-cleans. It runs only whenLARK_SLIDES_HISTORY_E2E=1and therefore does not yet exercise the default live lane. - TestSlidesReplaceSlideNormalizationDryRunE2E / TestSlidesReplaceSlideEmptyReplacementDryRunE2E / TestSlidesReplaceSlideDryRunE2E: dry-run coverage for
+replace-slidethrough the built binary. The normalization case provesreplace/insert,target_id,content, andelementbecome a canonical request and that structured output records all conversions. The other cases preserve the strict boundary: an actually-empty canonical payload still fails, while a legitimate mixedblock_replace+block_insertbatch remains unchanged. - TestSlides_ReplaceSlideAliasWorkflowAsUser: live alias round trip on a throwaway presentation. It reads server-assigned block IDs, replaces one target through
replace/target_id/content, inserts another throughinsert/element, reads the deck back to prove both writes persisted in the requested position while a control block survived, and deletes the presentation in cleanup. - TestSlides_ImageUploadDryRunParentType: dry-run coverage for the drive
parent_typean image upload carries through+media-upload --fileand the<img src="@...">placeholder pipeline behind+add-slide/+update-slide. A native deck must upload asslide_fileand an imported "office" deck asoffice_slide_file; the negative half matters most, because the backend does not validateparent_nodeagainst theparent_type, so a wrong value uploads successfully and only shows up later as an image that will not render. Each of the three surfaces is also exercised with a wiki--presentation, whose real token a preview must not resolve; those cases pinslide_file, which is sound rather than a guess becauseresolvePresentationIDrejects any wiki node whoseobj_typeis notslidesand an imported office deck is a drivefilenode. They exist because the production code now asserts that value directly instead of arriving at it by running the placeholder through the office check.+createis deliberately absent from this lane: it has no--presentationflag, so it always uploads into a deck it just created through the API, and its native-only expectation is pinned in the unit lane where it can be stated as such. - TestSlidesMediaDownloadDryRunE2E / TestSlidesMediaDownloadValidationDryRunE2E / TestSlidesMediaDownloadOutputConflictDryRunE2E: dry-run coverage for
+media-downloadthrough the built binary. Pins both requests the shortcut plans — the direct Drive media download first, and thepreview_download?preview_type=16source-file preview fallback second — along with thefile_tokenand resolvedoutputfields across--output,--output-dir, and default output-dir. The validation cases pin the empty-token and output/output-dir conflict envelopes through the real command registration, which the package test (stubbing at the HTTP layer) cannot reach. - TestSlidesMediaUploadDownloadLiveE2E: required live-backend assertion for the media upload→download round trip; creates a throwaway presentation, generates a deterministic 8×8 PNG fixture, uploads it via
+media-upload, verifies the returnedfile_token,file_name,presentation_id, andsizematch the local fixture, then downloads the token back via+media-download, verifies the saved path lands under--output-dir, the reportedcontent_typeis image/*,sourceis either"download"or"preview", and the on-disk byte count matches the reportedsize. The presentation is deleted in cleanup. This is the only layer that can prove a real Slides media token survives the direct-to-preview transition and returns decodable image bytes.
Command Table
| Status | Cmd | Type | Testcase | Key parameter shapes | Notes / uncovered reason |
|---|---|---|---|---|---|
| ✓ | slides +create | shortcut | slides_create_workflow_test.go::TestSlides_CreateWorkflowAsUser/create presentation with slide as user; slides_create_slide_inputs_dryrun_test.go::TestSlidesCreateRepeatedSlideFileDryRunE2E, TestSlidesCreateSlidesFileAndStdinDryRunE2E, TestSlidesCreateRejectsBothSlideFormsDryRunE2E | --title; --slides ["<slide ...>"] / --slides @deck.json / --slides -; repeated --slide @page.xml |
live lane reads back through raw slides API to prove persisted XML; dry-run lane pins the file inputs and the mutual-exclusion refusal |
| ✓ | slides +add-slide | shortcut | slides_slide_add_delete_dryrun_test.go::TestSlidesAddSlideDryRunE2E; slides_slide_add_delete_workflow_test.go::TestSlides_SlideAddDeleteWorkflowAsUser | --slide "<slide ...>"; --before-slide-id; --revision-id |
live append and insert both verified by reading the deck back |
| ✓ | slides +delete-slide | shortcut | slides_slide_add_delete_dryrun_test.go::TestSlidesDeleteSlideDryRunE2E, TestSlidesDeleteSlideWikiDryRunE2E; slides_slide_add_delete_workflow_test.go::TestSlides_SlideAddDeleteWorkflowAsUser | --slide-id; --revision-id; wiki URL |
live delete runs on a throwaway deck; readback proves the neighbours survive |
| ✓ | slides +update-slide | shortcut | slides_update_slide_dryrun_test.go::TestSlidesUpdateSlideDryRunE2E (+ alias / refusal cases); slides_update_slide_workflow_test.go::TestSlidesUpdateSlideLiveE2E; slides_history_workflow_test.go::TestSlides_HistoryWorkflow (opt-in history/revert) | --presentation; --slide-id; --content "<slide ...>"; --revision-id |
default live CI proves a real in-place update and readback; opt-in workflow adds history/revert and element-id preservation |
| ✓ | slides +replace-slide | shortcut | slides_replace_slide_dryrun_test.go::TestSlidesReplaceSlideNormalizationDryRunE2E, TestSlidesReplaceSlideEmptyReplacementDryRunE2E, TestSlidesReplaceSlideDryRunE2E; slides_replace_slide_workflow_test.go::TestSlides_ReplaceSlideAliasWorkflowAsUser | --presentation; --slide-id; canonical and compatibility --parts shapes |
dry-run pins canonical request construction and validation; live workflow proves alias replace/insert persistence, target ID preservation, insertion ordering, control-block survival, and cleanup |
| ✓ | slides +media-upload | shortcut | slides_image_upload_dryrun_test.go::TestSlides_ImageUploadDryRunParentType (dry-run); slides_media_workflow_test.go::TestSlidesMediaUploadDownloadLiveE2E (live round trip) | --presentation with a native, an imported-office, and an unresolved wiki reference; --file |
dry-run lane pins the native/office parent_type split across +media-upload and the @path placeholder pipeline, plus the wiki case, which is native by construction because a non-slides wiki node never reaches an upload; live round-trip proves a real Slides media token uploads successfully and survives the direct-to-preview transition when downloaded back |
| ✓ | slides +media-download | shortcut | slides_media_download_dryrun_test.go::TestSlidesMediaDownloadDryRunE2E, TestSlidesMediaDownloadValidationDryRunE2E, TestSlidesMediaDownloadOutputConflictDryRunE2E; slides_media_workflow_test.go::TestSlidesMediaUploadDownloadLiveE2E (live round trip) | --file-token; --output / --output-dir |
dry-run pins the two-step direct→preview plan with preview_type=16, output resolution, and validation envelopes through the real binary; live round-trip proves a real Slides media token downloads successfully (either direct or preview fallback) with matching byte count and image content type |