Skip to content

Commit d4390e1

Browse files
committed
fix: Fix test failures and lint errors in feature flag tests
- Fix typo: PostHogSDK.testIntance -> PostHogSDK.testInstance - Add type annotation for nil anonymousId parameter - Update tests to use PostHogSDK.with(config) for SDK-level methods - Add identify() calls to enable person processing in tests - Update reset test to check for removal of custom properties - Fix trailing whitespace lint errors Fixes test failures that were introduced when tests were updated to use new person and group properties methods.
1 parent 542f721 commit d4390e1

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

PostHogTests/PostHogContextTest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ class PostHogContextTest: QuickSpec {
7474
expect(context["$app_version"] as? String) != nil
7575
expect(context["$app_build"] as? String) != nil
7676
expect(context["$locale"] as? String) != nil
77-
77+
7878
#if os(iOS) || os(tvOS) || os(visionOS)
7979
expect(context["$os_name"] as? String) != nil
8080
expect(context["$os_version"] as? String) != nil
8181
expect(context["$device_type"] as? String) != nil
8282
expect(context["$device_manufacturer"] as? String) == "Apple"
8383
expect(context["$device_model"] as? String) != nil
8484
#endif
85-
85+
8686
// Verify it doesn't include non-person properties
8787
expect(context["$app_namespace"] as? String) == nil
8888
expect(context["$is_emulator"] as? Bool) == nil

PostHogTests/PostHogFeatureFlagsTest.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ enum PostHogFeatureFlagsTest {
195195
@Test("Person properties are stored and retrieved correctly")
196196
func storeAndRetrievePersonProperties() async {
197197
let sut = PostHogSDK.with(config)
198-
198+
199199
// Enable person processing by identifying
200200
sut.identify("test_user")
201-
201+
202202
let properties = [
203203
"test_property": "test_value",
204204
"plan": "premium",
@@ -242,7 +242,7 @@ enum PostHogFeatureFlagsTest {
242242
@Test("Person properties are additive")
243243
func personPropertiesAreAdditive() async {
244244
let sut = PostHogSDK.with(config)
245-
245+
246246
// Enable person processing
247247
sut.identify("test_user")
248248

@@ -283,7 +283,7 @@ enum PostHogFeatureFlagsTest {
283283
@Test("Reset person properties clears all properties")
284284
func resetPersonPropertiesClearsAll() async {
285285
let sut = PostHogSDK.with(config)
286-
286+
287287
// Enable person processing
288288
sut.identify("test_user")
289289

@@ -322,10 +322,10 @@ enum PostHogFeatureFlagsTest {
322322
@Test("Group properties are stored and retrieved correctly")
323323
func storeAndRetrieveGroupProperties() async {
324324
let sut = PostHogSDK.with(config)
325-
325+
326326
// Enable person processing
327327
sut.identify("test_user")
328-
328+
329329
let properties = [
330330
"plan": "enterprise",
331331
"seats": 50,
@@ -371,7 +371,7 @@ enum PostHogFeatureFlagsTest {
371371
@Test("Multiple group types are handled correctly")
372372
func multipleGroupTypesHandled() async {
373373
let sut = PostHogSDK.with(config)
374-
374+
375375
// Enable person processing
376376
sut.identify("test_user")
377377

@@ -409,7 +409,7 @@ enum PostHogFeatureFlagsTest {
409409
@Test("Reset group properties for specific type")
410410
func resetGroupPropertiesSpecificType() async {
411411
let sut = PostHogSDK.with(config)
412-
412+
413413
// Enable person processing
414414
sut.identify("test_user")
415415

@@ -450,7 +450,7 @@ enum PostHogFeatureFlagsTest {
450450
@Test("Reset all group properties")
451451
func resetAllGroupProperties() async {
452452
let sut = PostHogSDK.with(config)
453-
453+
454454
// Enable person processing
455455
sut.identify("test_user")
456456

@@ -485,7 +485,7 @@ enum PostHogFeatureFlagsTest {
485485
@Test("Both person and group properties sent together")
486486
func bothPersonAndGroupPropertiesSent() async {
487487
let sut = PostHogSDK.with(config)
488-
488+
489489
// Enable person processing
490490
sut.identify("test_user")
491491

0 commit comments

Comments
 (0)