test(external): add unit tests for create-from-template action#13942
test(external): add unit tests for create-from-template action#13942dj4oC wants to merge 2 commits into
Conversation
The "create from template" action extension added in PR #11775 (useActionExtensionCreateFromTemplate) had no unit test coverage. This adds a spec covering isVisible (selection count, missing personal space, non-downloadable resource, no matching template mime type, and the positive case) and handler (successful creation and editor navigation with context-route params, duplicate-filename resolution, and the error path that surfaces showErrorMessage). Closes: #11786 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: dj4oC <noreply@github.com>
|
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
|
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Closes: #11786 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: dj4oC <noreply@github.com>
|
|
Superseded by owncloud/ocis#12544. The 🤖 Automated by Claude Code Generated by Claude Code |



Description
Adds unit test coverage for the "create from template" action extension
(
useActionExtensionCreateFromTemplateinpackages/web-app-external/src/extensions/createFromTemplate.ts), which wasintroduced in #11775 and previously had no tests (no
tests/unit/extensions/directory existed).
New file:
packages/web-app-external/tests/unit/extensions/createFromTemplate.spec.ts.isVisiblecases covered:falsefalsefalsefalsetruehandlercases covered:contextRouteName/contextRouteParams/contextRouteQueryparamsresolveFileNameDuplicatewhen a file of thesame name already exists in the personal space root
showErrorMessageis called when the webdavlistFilescallor
createFileHandlerthrowsRelated Issue
Motivation and Context
The action was shipped without unit tests. These tests pin down the visibility
predicate and the create/navigate/error flow so future changes to the extension
are guarded.
How Has This Been Tested?
pnpm --filter external test:unit(vitest 4.1.6, node 22)Test Files 1 passed,Tests 9 passed (9)src/extensions/createFromTemplate.ts: 97.56% lines, 100%branches, 88.88% funcs (well above the 85% target; the single uncovered
function is the
label()getter, which is not part of the acceptance criteria)eslinton the new file: cleanprettier --check: cleanvue-tsc --noEmit: no type errorsThis is a test-only change — no product code is modified.
Documentation checklist
changelog/unreleased/change-add-create-from-template-tests.LICENSEand carries no per-file SPDX headers on any existing source or test file, so
none were added, to stay consistent with the codebase.
UI change).
Phase 4 pre-flight review (non-blocking findings): none — the change adds an
isolated spec with fully mocked dependencies (no network, deterministic).
Risk level: minimal (adds tests only).
Open tasks:
🤖 Automated by Claude Code