Skip to content

Commit cf1796a

Browse files
authored
Merge branch 'main' into camden-king/migration-bug-fixes
2 parents 5b30eb9 + 6f340a9 commit cf1796a

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

GoogleSignIn/Tests/Unit/GIDSignInTest.m

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,8 @@ @interface GIDSignInTest : XCTestCase {
272272
// Status returned by saveAuthorization:toKeychainForName:
273273
BOOL _saveAuthorizationReturnValue;
274274

275-
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
276275
// Test userDefaults for use with `GIDAppCheck`
277276
NSUserDefaults *_testUserDefaults;
278-
#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
279277
}
280278
@end
281279

@@ -342,16 +340,13 @@ - (void)setUp {
342340
[_fakeMainBundle fakeAllSchemesSupported];
343341

344342
// Object under test
345-
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kAppHasRunBeforeKey];
343+
_testUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:kUserDefaultsSuiteName];
344+
[_testUserDefaults setBool:YES forKey:kAppHasRunBeforeKey];
346345

347346
_signIn = [[GIDSignIn alloc] initWithKeychainStore:_keychainStore
348347
authStateMigrationService:_authStateMigrationService];
349348
_hint = nil;
350349

351-
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
352-
_testUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:kUserDefaultsSuiteName];
353-
#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
354-
355350
__weak GIDSignInTest *weakSelf = self;
356351
_completion = ^(GIDSignInResult *_Nullable signInResult, NSError * _Nullable error) {
357352
GIDSignInTest *strongSelf = weakSelf;
@@ -378,11 +373,7 @@ - (void)tearDown {
378373
OCMVerifyAll(_presentingWindow);
379374
#endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
380375

381-
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kAppHasRunBeforeKey];
382-
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
383-
[_testUserDefaults removeObjectForKey:kGIDAppCheckPreparedKey];
384-
[_testUserDefaults removeSuiteNamed:kUserDefaultsSuiteName];
385-
#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
376+
[_testUserDefaults removePersistentDomainForName:kUserDefaultsSuiteName];
386377

387378
[_fakeMainBundle stopFaking];
388379
[super tearDown];

0 commit comments

Comments
 (0)