-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathAuthenticatorBridgeDataStoreTests.swift
More file actions
37 lines (32 loc) · 1.54 KB
/
AuthenticatorBridgeDataStoreTests.swift
File metadata and controls
37 lines (32 loc) · 1.54 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
import XCTest
@testable import AuthenticatorBridgeKit
final class AuthenticatorBridgeDataStoreTests: XCTestCase {
func test_persistedStoreURL_prefersAppGroupContainer() {
let subject = AuthenticatorBridgeDataStore.persistedStoreURL(
groupIdentifier: "group.com.8bit.bitwarden",
bundleIdentifier: "com.8bit.bitwarden",
bundlePath: "/tmp/Bitwarden.app",
containerURLProvider: { _, _ in URL(fileURLWithPath: "/tmp/group-container", isDirectory: true) }
)
XCTAssertEqual(subject.path, "/tmp/group-container/Bitwarden-Authenticator.sqlite")
}
func test_persistedStoreURL_fallsBackForSimulatorAppExtension() {
let fileManager = FileManager.default
let subject = AuthenticatorBridgeDataStore.persistedStoreURL(
fileManager: fileManager,
groupIdentifier: "group.com.8bit.bitwarden",
bundleIdentifier: "com.8bit.bitwarden.find-login-action-extension",
bundlePath: "/tmp/BitwardenActionExtension.appex",
containerURLProvider: { _, _ in nil }
)
let applicationSupportURL = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).first
?? fileManager.temporaryDirectory
XCTAssertEqual(
subject.path,
applicationSupportURL
.appendingPathComponent("com.8bit.bitwarden.find-login-action-extension", isDirectory: true)
.appendingPathComponent("Bitwarden-Authenticator.sqlite")
.path
)
}
}