Skip to content

test: cover 204 / custom headers / JSONFILE mode / download-error paths#299

Merged
MarshallOfSound merged 1 commit into
mainfrom
sam/expand-test-coverage
May 2, 2026
Merged

test: cover 204 / custom headers / JSONFILE mode / download-error paths#299
MarshallOfSound merged 1 commit into
mainfrom
sam/expand-test-coverage

Conversation

@MarshallOfSound
Copy link
Copy Markdown
Collaborator

Stacked on #298.

Fills gaps between this suite and electron/spec/api-autoupdater-darwin-spec.ts for behaviors that already exist in Squirrel/ source. 56 → 63 tests, 0 failures.

Added (SQRLUpdaterSpec.m)

  • checkForUpdatesCommand → 204 No Content treated as no-update
  • checkForUpdatesCommand → custom request headers reach the server
  • checkForUpdatesCommand JSONFILE mode → picks matching release's updateTo when currentRelease is newer
  • checkForUpdatesCommand JSONFILE mode → no download when currentRelease == running version
  • checkForUpdatesCommand JSONFILE mode → no download when currentRelease < running version
  • checkForUpdatesCommand JSONFILE mode → invalid body → SQRLUpdaterErrorInvalidServerBody
  • response handling → download endpoint non-2xx → error

Also re-enables the SQUIRREL_TEST_LOCAL_CDN / _SERVER scheme env vars (dropped in the #297 squash).

Skipped (blocked on patch upstream — separate PRs incoming)

  • ElectronSquirrelPreventDowngrades (4 specs)
  • prune orphaned staged updates / bounded count / quitAndInstall race
  • SquirrelMacEnableDirectContentsWrite
  • abort-if-app-still-running
  • nested-code strict-validate failures
  • zip-extract launch failure

Base automatically changed from sam/deps-align-electron to main May 2, 2026 22:41
Ports the cheapest of Electron's api-autoupdater-darwin-spec.ts cases
that map onto behaviour already in this repo's source:

- 204 No Content -> command completes with no update, updateFromJSONData
  is never reached
- custom request headers survive the mutableCopy and reach the server
- download endpoint non-2xx surfaces SQRLUpdaterErrorInvalidServerResponse
  with the 'Update download failed' description
- JSONFILE mode (-initWithUpdateRequest:forVersion:): picks the matching
  release's updateTo when currentRelease is newer; bails out cleanly
  when currentRelease equals or is older than the running version;
  errors with SQRLUpdaterErrorInvalidServerBody on malformed JSON

Captures the body handed to updateFromJSONData: so the JSONFILE specs
can assert which release was selected.

Also re-flips the SQUIRREL_TEST_LOCAL_CDN / _SERVER scheme env vars
that were dropped in the #297 squash-merge.
@MarshallOfSound MarshallOfSound force-pushed the sam/expand-test-coverage branch from 54b6e92 to 5295339 Compare May 2, 2026 22:42
@MarshallOfSound MarshallOfSound merged commit bd47337 into main May 2, 2026
1 check passed
@MarshallOfSound MarshallOfSound deleted the sam/expand-test-coverage branch May 2, 2026 22:47
MarshallOfSound added a commit that referenced this pull request May 2, 2026
Stacked on #299.

`-Werror` was disabled project-wide in #296 to unblock the vendored
ReactiveCocoa 2.5 build. With #298 we control the warning surface again,
so turn it back on for our targets and fix what's left. **63/63 tests,
zero warnings in Squirrel-owned code.**

#### Mechanism
The CLI `GCC_TREAT_WARNINGS_AS_ERRORS=NO` override has to stay
(ReactiveObjC's `RACTestScheduler.m` still trips
`-Wimplicit-int-float-conversion`), and CLI overrides win over *all*
project/target settings. So instead of fighting that, set `OTHER_CFLAGS
= -Werror` at the Squirrel project level — CLI doesn't touch
`OTHER_CFLAGS`, and it only propagates to our five targets, not the
vendor xcodeprojs. Also flipped the project-level
`GCC_TREAT_WARNINGS_AS_ERRORS` back to `YES` for builds that bypass
`script/test`.

#### Real fixes
- `SQRLShipItRequest.m` / `SQRLUpdaterSpec.m`:
`+JSONDictionaryFromModel:` → `:error:`
- `SQRLUpdate.m`: `+reversibleTransformerWithForwardBlock:reverseBlock:`
→ `+transformerUsingForwardBlock:reverseBlock:`
- `SQRLDownloadedUpdate.m`: dropped dead `+JSONKeyPathsByPropertyKey`
returning `NSNull.null` (would assert under Mantle 2; class isn't
`<MTLJSONSerializing>`)
- `TestApplication-Info.plist`: `LSApplicationCategoryType`

#### Pragma
- `QuickSpec+SQRLFixtures.m`: `SMJobRemove` (test cleanup only;
`SMAppService` requires registering via the same API)

#### Punted
- `UTTypeConformsTo` / `launchApplicationAtURL` — neither warns at
deployment target 10.13. The replacements are 11.0+/10.15+ only, so a
real fix needs `@available` branching that keeps the deprecated path
anyway. Separate PRs (or a deployment-target bump) handle these.
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