Dashboard › cli › Distillation
2aa6eb7f-b424-41f7-8640-6c8f3fcc66c3["lore_tm_v1_8CR45QBryRDOYbhHlyPaPbXBqgvIupHAy88HmVSbP20"]
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts lines 808–824 define mockFetch(fn) by assigning globalThis.fetch, save the original fetch in beforeEach(), and restore it in afterEach().fetchRecentReleases() tests verify the default GitHub API URL contains api.github.com/repos/getsentry/toolkit/releases and a per_page= query, returns 2 releases headed by tag 0.14.0, and returns [] for both HTTP 500 and a thrown TypeError("fetch failed").fetchRecentReleases(undefined, LEGACY_UPGRADE_SOURCE) and expects exactly https://api.github.com/repos/getsentry/cli/releases?per_page=12.downloadStablePatch() tests verify a successful request to https://example.com/patch.bin returns Uint8Array([1, 2, 3, 4, 5]), while HTTP 404 and a thrown TypeError("fetch failed") return null.resolveStableChain test helper versionHex(version) deterministically converts each character to a two-digit hexadecimal character code and concatenates the results.resolveStableChain test helper setupStableMocks(releases, patches) serves JSON release data for URLs beginning with https://api.github.com/, serves mapped patch bytes with HTTP 200, and returns HTTP 404 for unknown patch URLs.resolveStableChain("0.13.0", "0.14.0") test uses a target 0.14.0 release containing the platform binary with sha256:${versionHex("0.14.0")}, a 100-byte ${binaryName}.patch, and a 100,000-byte ${binaryName}.gz; it expects 1 downloaded patch with bytes [10, 20, 30], expectedSha256 === versionHex("0.14.0"), and step { fromVersion: "0.13.0", toVersion: "0.14.0" }.resolveStableChain("0.13.0", "0.14.0", undefined, LEGACY_UPGRADE_SOURCE), expects null after HTTP 404, expects its only request to be https://api.github.com/repos/getsentry/cli/releases?per_page=12, and asserts no requested URL contains getsentry/toolkit.resolveStableChain("0.13.0", "0.15.0") test defines 2-byte patches patchA=[1, 2] for 0.14.0 and patchB=[3, 4] for 0.15.0; each listed patch asset is 50 bytes and each target gzip asset is 100,000 bytes.patchA, then patchB) and exact steps: 1. { fromVersion: "0.13.0", toVersion: "0.14.0" }; 2. { fromVersion: "0.14.0", toVersion: "0.15.0" }.resolveStableChain("0.12.0", "0.14.0") is expected to return null when the mocked release list contains only 0.13.0 and the target release is absent.