Skip to content

Unit tests and refactoring to make it testable - #84

Merged
marandaneto merged 30 commits into
v3.0.0from
chore/add-tests
Nov 2, 2023
Merged

marandaneto merged 30 commits into
v3.0.0from
chore/add-tests

Conversation

@marandaneto

@marandaneto marandaneto commented Oct 30, 2023 •

Copy link
Copy Markdown
Member

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
Comment thread .github/workflows/build-examples.yml Resolved
Comment thread PostHog/PostHogApi.swift Resolved
Comment thread PostHog/PostHogFeatureFlags.swift Resolved
Comment thread PostHog/PostHogQueue.swift Resolved
Comment thread PostHog/PostHogQueue.swift Resolved
Comment thread PostHog/PostHogStorage.swift Resolved
@marandaneto
marandaneto marked this pull request as ready for review October 31, 2023 12:43
Comment thread Package.swift
Comment on lines +31 to +37
dependencies: [
"PostHog",
"Quick",
"Nimble",
"OHHTTPStubs",
.product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"),
],

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread PostHog/PostHogSDK.swift Resolved

@benjackwhite benjackwhite 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.

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

Comment thread PostHog/PostHogSDK.swift 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
@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