File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,38 @@ class LocalStorageTests: XCTestCase {
33
33
XCTAssertEqual ( localStorage. email, email)
34
34
}
35
35
36
+ func testAuthDataInKeychain( ) {
37
+ let testUserDefaults = LocalStorageTests . getTestUserDefaults ( )
38
+ let testKeychain = IterableKeychain . init ( wrapper: KeychainWrapper . init ( serviceName: " test-localstorage " ) )
39
+
40
+ var localStorage = LocalStorage ( userDefaults: testUserDefaults,
41
+ keychain: testKeychain)
42
+
43
+ let userId = " user-id "
44
+
45
+ localStorage. userId = userId
46
+
47
+ XCTAssertNil ( testUserDefaults. string ( forKey: " userId " ) )
48
+
49
+ XCTAssertEqual ( testKeychain. userId, userId)
50
+
51
+
52
+
53
+ localStorage. email = email
54
+
55
+ XCTAssertNil ( testUserDefaults. string ( forKey: " email " ) )
56
+
57
+ XCTAssertEqual ( testKeychain. email, email)
58
+
59
+ let authToken = " token "
60
+
61
+ localStorage. authToken = authToken
62
+
63
+ XCTAssertNil ( testUserDefaults. string ( forKey: " authToken " ) )
64
+
65
+ XCTAssertEqual ( testKeychain. authToken, authToken)
66
+ }
67
+
36
68
func testDDLChecked( ) throws {
37
69
var localStorage = LocalStorage ( userDefaults: LocalStorageTests . getTestUserDefaults ( ) )
38
70
localStorage. ddlChecked = true
You can’t perform that action at this time.
0 commit comments