@@ -14,6 +14,7 @@ import Keychain
14
14
// Define the keys used for this test.
15
15
extension Keys {
16
16
static let stringValue = Key < String ? > ( " stringValue " )
17
+ static let codableValue = Key < String ? > ( " codableValue " )
17
18
}
18
19
19
20
private struct TestCodable : Codable , Equatable {
@@ -52,29 +53,29 @@ class KeychainSpec: QuickSpec {
52
53
it ( " should be able to write a codable value to the keychain " ) {
53
54
let value = TestCodable ( identifier: " 123 " ,
54
55
timestamp: Date ( timeIntervalSince1970: 2000 ) )
55
- keychain [ . testKey ] = value
56
- expect ( keychain [ . testKey ] ) == value
56
+ Keychain [ . codableValue ] = value
57
+ expect ( Keychain [ . codableValue ] ) == value
57
58
}
58
59
59
60
it ( " Should override a codable value to the keychain " ) {
60
61
let value1 = TestCodable ( identifier: " 123 " ,
61
62
timestamp: Date ( timeIntervalSince1970: 2000 ) )
62
63
let value2 = TestCodable ( identifier: " 456 " ,
63
64
timestamp: Date ( timeIntervalSince1970: 3000 ) )
64
- keychain [ . testKey ] = value1
65
- keychain [ . testKey ] = value2
65
+ Keychain [ . codableValue ] = value1
66
+ Keychain [ . codableValue ] = value2
66
67
67
- expect ( keychain [ . testKey ] ) == value2
68
+ expect ( Keychain [ . codableValue ] ) == value2
68
69
}
69
70
70
71
it ( " should be able to delete a codable value from the keychain " ) {
71
72
let value = TestCodable ( identifier: " 123 " ,
72
73
timestamp: Date ( timeIntervalSince1970: 2000 ) )
73
- keychain [ . testKey ] = value
74
- expect ( keychain [ . testKey ] ) . toNot ( beNil ( ) )
74
+ Keychain [ . codableValue ] = value
75
+ expect ( Keychain [ . codableValue ] ) . toNot ( beNil ( ) )
75
76
76
- keychain [ . testKey ] = nil
77
- expect ( keychain [ . testKey ] ) . to ( beNil ( ) )
77
+ Keychain [ . codableValue ] = nil
78
+ expect ( Keychain [ . codableValue ] ) . to ( beNil ( ) )
78
79
}
79
80
}
80
81
}
0 commit comments