test: cover 204 / custom headers / JSONFILE mode / download-error paths#299
Merged
Conversation
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.
54b6e92 to
5295339
Compare
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.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #298.
Fills gaps between this suite and
electron/spec/api-autoupdater-darwin-spec.tsfor behaviors that already exist inSquirrel/source. 56 → 63 tests, 0 failures.Added (
SQRLUpdaterSpec.m)checkForUpdatesCommand→ 204 No Content treated as no-updatecheckForUpdatesCommand→ custom request headers reach the servercheckForUpdatesCommandJSONFILE mode → picks matching release'supdateTowhencurrentReleaseis newercheckForUpdatesCommandJSONFILE mode → no download whencurrentRelease== running versioncheckForUpdatesCommandJSONFILE mode → no download whencurrentRelease< running versioncheckForUpdatesCommandJSONFILE mode → invalid body →SQRLUpdaterErrorInvalidServerBodyresponse handling→ download endpoint non-2xx → errorAlso re-enables the
SQUIRREL_TEST_LOCAL_CDN/_SERVERscheme env vars (dropped in the #297 squash).Skipped (blocked on patch upstream — separate PRs incoming)
ElectronSquirrelPreventDowngrades(4 specs)quitAndInstallraceSquirrelMacEnableDirectContentsWrite