-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathKeychainStoreErrorTest.swift
More file actions
40 lines (34 loc) · 1.2 KB
/
Copy pathKeychainStoreErrorTest.swift
File metadata and controls
40 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// KeychainStoreErrorTest.swift
// NativeAppTemplate
//
@testable import NativeAppTemplate
import Foundation
import Testing
@Suite
struct KeychainStoreErrorTest {
@Test
func errorCodes() {
let underlying = NSError(domain: "test", code: 1)
#expect(KeychainStoreError.secCallFailed(underlying).errorCode == "NATIVEAPPTEMPLATE-4001")
#expect(KeychainStoreError.notFound.errorCode == "NATIVEAPPTEMPLATE-4002")
#expect(KeychainStoreError.badData.errorCode == "NATIVEAPPTEMPLATE-4003")
#expect(KeychainStoreError.archiveFailure(underlying).errorCode == "NATIVEAPPTEMPLATE-4004")
}
@Test
func formattedDescriptions() {
#expect(
KeychainStoreError.notFound.formattedDescription
== "[NATIVEAPPTEMPLATE-4002] KeychainStoreError::NotFound"
)
#expect(
KeychainStoreError.badData.formattedDescription
== "[NATIVEAPPTEMPLATE-4003] KeychainStoreError::BadData"
)
}
@Test
func codedDescriptionPrependsCode() {
let error: Error = KeychainStoreError.notFound
#expect(error.codedDescription == "[NATIVEAPPTEMPLATE-4002] KeychainStoreError::NotFound")
}
}