@@ -95,16 +95,14 @@ final class SwitchUserIntegrationTests: XCTestCase {
9595 // 1. Set up mock responses for the first anonymous user
9696 let tagsUserAnon = [ " tag_anon " : " value_anon " ]
9797 MockUserRequests . setDefaultCreateAnonUserResponses ( with: client)
98- MockUserRequests . setAddTagsResponse ( with: client, tags: tagsUserAnon)
99- MockUserRequests . setSetLanguageResponse ( with: client, language: " lang_anon " )
98+ MockUserRequests . setAddTagsAndLanguageResponse ( with: client, tags: tagsUserAnon, language: " lang_anon " )
10099 MockUserRequests . setAddAliasesResponse ( with: client, aliases: [ " alias_anon " : " id_anon " ] )
101100 MockUserRequests . setAddEmailResponse ( with
: client
, email
: " [email protected] " ) 102101
103102 // 2. Set up mock responses for User A with 409 conflict response
104103 let tagsUserA = [ " tag_a " : " value_a " ]
105104 MockUserRequests . setDefaultIdentifyUserResponses ( with: client, externalId: userA_EUID, conflicted: true )
106- MockUserRequests . setAddTagsResponse ( with: client, tags: tagsUserA)
107- MockUserRequests . setSetLanguageResponse ( with: client, language: " lang_a " )
105+ MockUserRequests . setAddTagsAndLanguageResponse ( with: client, tags: tagsUserA, language: " lang_a " )
108106 MockUserRequests . setAddAliasesResponse ( with: client, aliases: [ " alias_a " : " id_a " ] )
109107 MockUserRequests . setAddEmailResponse ( with
: client
, email
: " [email protected] " ) 110108 MockUserRequests . setTransferSubscriptionResponse ( with: client, externalId: userA_EUID)
@@ -135,13 +133,9 @@ final class SwitchUserIntegrationTests: XCTestCase {
135133 XCTAssertTrue ( client. allRequestsHandled)
136134
137135 // 1. Asserts for first Anonymous User
138- XCTAssertTrue ( client. onlyOneRequest ( // Tag
139- contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) " ,
140- contains: [ " properties " : [ " tags " : tagsUserAnon] ] )
141- )
142- XCTAssertTrue ( client. onlyOneRequest ( // Language
136+ XCTAssertTrue ( client. onlyOneRequest ( // Tag + Language
143137 contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) " ,
144- contains: [ " properties " : [ " language " : " lang_anon " ] ] )
138+ contains: [ " properties " : [ " language " : " lang_anon " , " tags " : tagsUserAnon ] ] )
145139 )
146140 XCTAssertTrue ( client. onlyOneRequest ( // Alias
147141 contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) /identity " ,
@@ -153,13 +147,9 @@ final class SwitchUserIntegrationTests: XCTestCase {
153147 )
154148
155149 // 2. Asserts for User A - expected requests are sent
156- XCTAssertTrue ( client. onlyOneRequest ( // Tag
150+ XCTAssertTrue ( client. onlyOneRequest ( // Tag + Language
157151 contains: " apps/test-app-id/users/by/onesignal_id/ \( userA_OSID) " ,
158- contains: [ " properties " : [ " tags " : tagsUserA] ] )
159- )
160- XCTAssertTrue ( client. onlyOneRequest ( // Language
161- contains: " apps/test-app-id/users/by/onesignal_id/ \( userA_OSID) " ,
162- contains: [ " properties " : [ " language " : " lang_a " ] ] )
152+ contains: [ " properties " : [ " language " : " lang_a " , " tags " : tagsUserA] ] )
163153 )
164154 XCTAssertTrue ( client. onlyOneRequest ( // Alias
165155 contains: " apps/test-app-id/users/by/onesignal_id/ \( userA_OSID) /identity " ,
@@ -209,23 +199,20 @@ final class SwitchUserIntegrationTests: XCTestCase {
209199 // 1. Set up mock responses for the first anonymous user
210200 let tagsUserAnon = [ " tag_anon " : " value_anon " ]
211201 MockUserRequests . setDefaultCreateAnonUserResponses ( with: client)
212- MockUserRequests . setAddTagsResponse ( with: client, tags: tagsUserAnon)
213- MockUserRequests . setSetLanguageResponse ( with: client, language: " lang_anon " )
202+ MockUserRequests . setAddTagsAndLanguageResponse ( with: client, tags: tagsUserAnon, language: " lang_anon " )
214203 MockUserRequests . setAddAliasesResponse ( with: client, aliases: [ " alias_anon " : " id_anon " ] )
215204 MockUserRequests . setAddEmailResponse ( with
: client
, email
: " [email protected] " ) 216205
217206 // 2. Set up mock responses for User A with 409 conflict response
218207 let tagsUserA = [ " tag_a " : " value_a " ]
219208 MockUserRequests . setDefaultIdentifyUserResponses ( with: client, externalId: userA_EUID, conflicted: true )
220- MockUserRequests . setAddTagsResponse ( with: client, tags: tagsUserA)
221- MockUserRequests . setSetLanguageResponse ( with: client, language: " lang_a " )
209+ MockUserRequests . setAddTagsAndLanguageResponse ( with: client, tags: tagsUserA, language: " lang_a " )
222210 MockUserRequests . setAddAliasesResponse ( with: client, aliases: [ " alias_a " : " id_a " ] )
223211 MockUserRequests . setAddEmailResponse ( with
: client
, email
: " [email protected] " ) 224212
225213 // 3. Set up mock responses for second Anonymous User
226214 let tagsUserB = [ " tag_b " : " value_b " ]
227- MockUserRequests . setAddTagsResponse ( with: client, tags: tagsUserB)
228- MockUserRequests . setSetLanguageResponse ( with: client, language: " lang_b " )
215+ MockUserRequests . setAddTagsAndLanguageResponse ( with: client, tags: tagsUserB, language: " lang_b " )
229216 MockUserRequests . setAddAliasesResponse ( with: client, aliases: [ " alias_b " : " id_b " ] )
230217 MockUserRequests . setAddEmailResponse ( with
: client
, email
: " [email protected] " ) 231218
@@ -260,13 +247,9 @@ final class SwitchUserIntegrationTests: XCTestCase {
260247 XCTAssertTrue ( client. allRequestsHandled)
261248
262249 // 1. Asserts for first Anonymous User
263- XCTAssertTrue ( client. onlyOneRequest ( // Tag
264- contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) " ,
265- contains: [ " properties " : [ " tags " : tagsUserAnon] ] )
266- )
267- XCTAssertTrue ( client. onlyOneRequest ( // Language
250+ XCTAssertTrue ( client. onlyOneRequest ( // Tag + Language
268251 contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) " ,
269- contains: [ " properties " : [ " language " : " lang_anon " ] ] )
252+ contains: [ " properties " : [ " language " : " lang_anon " , " tags " : tagsUserAnon ] ] )
270253 )
271254 XCTAssertTrue ( client. onlyOneRequest ( // Alias
272255 contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) /identity " ,
@@ -278,13 +261,9 @@ final class SwitchUserIntegrationTests: XCTestCase {
278261 )
279262
280263 // 2. Asserts for User A
281- XCTAssertTrue ( client. onlyOneRequest ( // Tag
282- contains: " apps/test-app-id/users/by/external_id/ \( userA_EUID) " ,
283- contains: [ " properties " : [ " tags " : tagsUserA] ] )
284- )
285- XCTAssertTrue ( client. onlyOneRequest ( // Language
264+ XCTAssertTrue ( client. onlyOneRequest ( // Tag + Language
286265 contains: " apps/test-app-id/users/by/external_id/ \( userA_EUID) " ,
287- contains: [ " properties " : [ " language " : " lang_a " ] ] )
266+ contains: [ " properties " : [ " language " : " lang_a " , " tags " : tagsUserA ] ] )
288267 )
289268 XCTAssertTrue ( client. onlyOneRequest ( // Alias
290269 contains: " apps/test-app-id/users/by/external_id/ \( userA_EUID) /identity " ,
@@ -296,13 +275,9 @@ final class SwitchUserIntegrationTests: XCTestCase {
296275 )
297276
298277 // 3. Asserts for the second Anonymous User
299- XCTAssertTrue ( client. onlyOneRequest ( // Tag
278+ XCTAssertTrue ( client. onlyOneRequest ( // Tag + Language
300279 contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) " ,
301- contains: [ " properties " : [ " tags " : tagsUserB] ] )
302- )
303- XCTAssertTrue ( client. onlyOneRequest ( // Language
304- contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) " ,
305- contains: [ " properties " : [ " language " : " lang_b " ] ] )
280+ contains: [ " properties " : [ " language " : " lang_b " , " tags " : tagsUserB] ] )
306281 )
307282 XCTAssertTrue ( client. onlyOneRequest ( // Alias
308283 contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) /identity " ,
@@ -347,24 +322,21 @@ final class SwitchUserIntegrationTests: XCTestCase {
347322 // 1. Set up mock responses for the first anonymous user
348323 let tagsUserAnon = [ " tag_anon " : " value_anon " ]
349324 MockUserRequests . setDefaultCreateAnonUserResponses ( with: client)
350- MockUserRequests . setAddTagsResponse ( with: client, tags: tagsUserAnon)
351- MockUserRequests . setSetLanguageResponse ( with: client, language: " lang_anon " )
325+ MockUserRequests . setAddTagsAndLanguageResponse ( with: client, tags: tagsUserAnon, language: " lang_anon " )
352326 MockUserRequests . setAddAliasesResponse ( with: client, aliases: [ " alias_anon " : " id_anon " ] )
353327 MockUserRequests . setAddEmailResponse ( with
: client
, email
: " [email protected] " ) 354328
355329 // 2. Set up mock responses for User A with 409 conflict response
356330 let tagsUserA = [ " tag_a " : " value_a " ]
357331 MockUserRequests . setDefaultIdentifyUserResponses ( with: client, externalId: userA_EUID, conflicted: true )
358- MockUserRequests . setAddTagsResponse ( with: client, tags: tagsUserA)
359- MockUserRequests . setSetLanguageResponse ( with: client, language: " lang_a " )
332+ MockUserRequests . setAddTagsAndLanguageResponse ( with: client, tags: tagsUserA, language: " lang_a " )
360333 MockUserRequests . setAddAliasesResponse ( with: client, aliases: [ " alias_a " : " id_a " ] )
361334 MockUserRequests . setAddEmailResponse ( with
: client
, email
: " [email protected] " ) 362335
363336 // 3. Set up mock responses for for User B
364337 let tagsUserB = [ " tag_b " : " value_b " ]
365338 MockUserRequests . setDefaultCreateUserResponses ( with: client, externalId: userB_EUID)
366- MockUserRequests . setAddTagsResponse ( with: client, tags: tagsUserB)
367- MockUserRequests . setSetLanguageResponse ( with: client, language: " lang_b " )
339+ MockUserRequests . setAddTagsAndLanguageResponse ( with: client, tags: tagsUserB, language: " lang_b " )
368340 MockUserRequests . setAddAliasesResponse ( with: client, aliases: [ " alias_b " : " id_b " ] )
369341 MockUserRequests . setAddEmailResponse ( with
: client
, email
: " [email protected] " ) 370342 // Returns mocked user data to test hydration
@@ -401,13 +373,9 @@ final class SwitchUserIntegrationTests: XCTestCase {
401373 XCTAssertTrue ( client. allRequestsHandled)
402374
403375 // 1. Asserts for first Anonymous User
404- XCTAssertTrue ( client. onlyOneRequest ( // Tag
405- contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) " ,
406- contains: [ " properties " : [ " tags " : tagsUserAnon] ] )
407- )
408- XCTAssertTrue ( client. onlyOneRequest ( // Language
376+ XCTAssertTrue ( client. onlyOneRequest ( // Tag + Language
409377 contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) " ,
410- contains: [ " properties " : [ " language " : " lang_anon " ] ] )
378+ contains: [ " properties " : [ " language " : " lang_anon " , " tags " : tagsUserAnon ] ] )
411379 )
412380 XCTAssertTrue ( client. onlyOneRequest ( // Alias
413381 contains: " apps/test-app-id/users/by/onesignal_id/ \( anonUserOSID) /identity " ,
@@ -419,13 +387,9 @@ final class SwitchUserIntegrationTests: XCTestCase {
419387 )
420388
421389 // 2. Asserts for User A
422- XCTAssertTrue ( client. onlyOneRequest ( // Tag
390+ XCTAssertTrue ( client. onlyOneRequest ( // Tag + Language
423391 contains: " apps/test-app-id/users/by/external_id/ \( userA_EUID) " ,
424- contains: [ " properties " : [ " tags " : tagsUserA] ] )
425- )
426- XCTAssertTrue ( client. onlyOneRequest ( // Language
427- contains: " apps/test-app-id/users/by/external_id/ \( userA_EUID) " ,
428- contains: [ " properties " : [ " language " : " lang_a " ] ] )
392+ contains: [ " properties " : [ " language " : " lang_a " , " tags " : tagsUserA] ] )
429393 )
430394 XCTAssertTrue ( client. onlyOneRequest ( // Alias
431395 contains: " apps/test-app-id/users/by/external_id/ \( userA_EUID) /identity " ,
@@ -437,13 +401,9 @@ final class SwitchUserIntegrationTests: XCTestCase {
437401 )
438402
439403 // 3. Asserts for User B - expected requests sent
440- XCTAssertTrue ( client. onlyOneRequest ( // Tag
441- contains: " apps/test-app-id/users/by/onesignal_id/ \( userB_OSID) " ,
442- contains: [ " properties " : [ " tags " : tagsUserB] ] )
443- )
444- XCTAssertTrue ( client. onlyOneRequest ( // Language
404+ XCTAssertTrue ( client. onlyOneRequest ( // Tag + Language
445405 contains: " apps/test-app-id/users/by/onesignal_id/ \( userB_OSID) " ,
446- contains: [ " properties " : [ " language " : " lang_b " ] ] )
406+ contains: [ " properties " : [ " language " : " lang_b " , " tags " : tagsUserB ] ] )
447407 )
448408 XCTAssertTrue ( client. onlyOneRequest ( // Alias
449409 contains: " apps/test-app-id/users/by/onesignal_id/ \( userB_OSID) /identity " ,
0 commit comments