Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests and refactoring to make it testable #84

Merged
merged 30 commits into from
Nov 2, 2023
Merged

Conversation

marandaneto
Copy link
Member

@marandaneto marandaneto commented Oct 30, 2023

What does this PR do?

Add tests for almost every class, also has a lot of fixing found during testing.

Where should the reviewer start?

How should this be manually tested?

Any background context you want to provide?
More tests can be added specifically for PostHogQueue, but its ok to add it later as well, its a bit complicated due to time advancing, and the URLSession callback approach, but I can expand it in another PR so we can unblock this PR that is getting quite big already.

What are the relevant tickets?

Screenshots or screencasts (if UI/UX change)

Questions:

  • Does the docs need an update?
  • Are there any security concerns?
  • Do we need to update engineering / success?

@marandaneto marandaneto changed the base branch from v3.0.0 to chore/sanitize-dictionary October 30, 2023 09:50
@marandaneto marandaneto marked this pull request as ready for review October 31, 2023 12:43
Comment on lines +31 to +37
dependencies: [
"PostHog",
"Quick",
"Nimble",
"OHHTTPStubs",
.product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"),
],
Copy link
Member Author

Choose a reason for hiding this comment

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

Here is what had to be done to make it work in CI, in combination with swift test instead of the xcode command for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

Xcode already defines those dependencies as SPM in its projects, but apparently, CI wasn't picking them up, maybe a Xcode version mismatch, an empty project worked just fine.

Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

Mostly skimmed the tests, but the actual functional changes all seem reasonable. Mammoth effort!

PostHog/PostHogSDK.swift Show resolved Hide resolved
Base automatically changed from chore/sanitize-dictionary to v3.0.0 November 2, 2023 09:15
@marandaneto marandaneto merged commit 52a6d76 into v3.0.0 Nov 2, 2023
4 checks passed
@marandaneto marandaneto deleted the chore/add-tests branch November 2, 2023 09:42
@marandaneto marandaneto mentioned this pull request Nov 2, 2023
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