Skip to content

Require the fetched message count before indexing in header fallback tests - #234

Merged
odrobnik merged 1 commit into
Cocoanetics:mainfrom
TabMail:fix/header-fallback-tests-require-count
Sep 10, 2026
Merged

odrobnik merged 1 commit into
Cocoanetics:mainfrom
TabMail:fix/header-fallback-tests-require-count

Conversation

@tabmail-kmyi

Copy link
Copy Markdown
Contributor

Summary

FetchMessageInfoHeaderFallbackTests asserts the fetched count with a non-fatal #expect(infos.count == 1) and then immediately subscripts infos[0]. If the fetch ever returns nothing, the subscript traps and takes the whole test process down, hiding every other result instead of reporting one failed test.

This switches the six count checks to try #require(infos.count == 1), matching the pattern already used in EMLByteLevelTests. No behavior change.

Verification

  • swift test --filter FetchMessageInfoHeaderFallbackTests: 6 tests in 1 suite passed.
  • swiftlint lint --strict: clean.
  • Fork CI (macOS, Linux, iOS, Android, SwiftLint) green on this exact commit.

Noticed while working on #233; kept separate since it is unrelated test hygiene.

…tests

`FetchMessageInfoHeaderFallbackTests` asserted `infos.count == 1` with a
non-fatal `#expect` and then subscripted `infos[0]`. If the fetch ever returns
nothing, the subscript traps and takes the whole test process down, hiding
every other result instead of reporting one failed test.

Switch the six count checks to `try #require`, which stops the test at the
failed count. No behavior change; `swift test --filter
FetchMessageInfoHeaderFallbackTests` passes 6 tests, SwiftLint strict is clean.

Signed-off-by: Kwang Moo Yi <kmyi@tabmail.ai>

@odrobnik odrobnik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings. The six changes correctly replace non-fatal count expectations with fatal try #require preconditions before infos[0] access. All affected tests already support throwing, the pattern is established in the same test target, and no production behavior is changed.

👍 No findings.

@odrobnik
odrobnik merged commit 3805cf4 into Cocoanetics:main Sep 10, 2026
6 checks passed
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.

2 participants