Skip to content

test: unit-test coverage Stage 1 + isomorphic helper cleanup#3147

Open
bk201- wants to merge 2 commits into
mainfrom
test/src-unit-coverage-stage1
Open

test: unit-test coverage Stage 1 + isomorphic helper cleanup#3147
bk201- wants to merge 2 commits into
mainfrom
test/src-unit-coverage-stage1

Conversation

@bk201-

@bk201- bk201- commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Establishes the first stage of unit-test coverage for the src/ folder and lands the
isomorphic-helper cleanup that supports it. Tracked in plans/UnitTestCoverage.Plan.md.

Unit tests — Stage 1 (pure logic)

Added focused unit tests (Vitest) for pure, isomorphic logic:

  • utils/cosmosDBAccountName — name validation + sanitization, including length boundaries
    and truncation edge cases.
  • utils/getErrorMessage — message extraction across Error / message-like / primitive /
    circular inputs.
  • utils/azureUtils — Azure Resource ID parsing (+ throw on malformed input).
  • utils/modelUtilsformatTokenCount, sortModelsAutoFirst, resolveSelectedModelId,
    and the partitionModelsByCapability domain predicate.
  • cosmosdb/priorityLevel — effective priority-level resolution.
  • cosmosdb/NoSqlQueryConnection — connection type-guard.
  • ParsedConnectionStringaccountId / accountName / fullId composition.
  • tree/TreeElementWith{ContextValue,Experience,StorageId} — type-guards (+ static
    createContextValue).
  • commands/.../CosmosDB{Database,Container,StoredProcedure,Trigger}NameStepvalidateInput
    tested directly on the subclass (wizard base + heavy data-plane imports mocked), no
    AzureWizard engine required.

Supporting refactors

  • modelUtils.partitionModelsByCapability now uses es-toolkit partition + orderBy
    instead of a hand-rolled loop/comparator (behavior locked by tests).
  • Replaced vscode-coupled @microsoft/vscode-azext-utils helpers with local isomorphic
    equivalents and added a no-restricted-syntax ESLint deny-list to keep a single allowed
    source: nonNull*, createContextValue (moved to TreeElementWithContextValue),
    openUrl, and randomUtils (→ Web Crypto globalThis.crypto). Removed the now-unused
    local randomUtils.
  • Replaced the deprecated createCosmosDBClient alias with createCosmosDBManagementClient
    at all call sites and removed the alias.

Validation

  • npm run build (tsc type-check across all tsconfigs) — clean.
  • npm run lint — oxlint + eslint, 0 errors.
  • npm run prettier-fix — applied.
  • npm run l10n — no string changes.
  • Full test suite: 1259 passed, 1 skipped.

No user-facing behavior changes; tests assert existing strings.

@bk201- bk201- requested a review from a team as a code owner June 11, 2026 15:00
@github-actions

Copy link
Copy Markdown
Contributor

🎭 E2E Tests (Playwright + VS Code)

Commit: 2495001
Pull Request: #3147 test: unit-test coverage Stage 1 + isomorphic helper cleanup

🧪 Result

  • E2E Tests: ✅ success

📥 Artifacts (run)

Tip: the HTML report artifact contains a self-contained Playwright report.
Download the zip, extract, and open index.html — or run
npx playwright show-report <extracted-dir> for the interactive view.

@github-actions

Copy link
Copy Markdown
Contributor

🔨 Build, Lint & Test

🔗 Source

📦 Package Information

🧪 Test Results

  • Unit Tests: ✅ success
  • Integration Tests (extension host): ✅ success

📥 Artifacts (run)

✅ Build Status

Build and local tests passed. See sibling comments below for E2E and NoSQL integration results.

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