-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathAppGroupContainerTests.swift
30 lines (27 loc) · 1.32 KB
/
AppGroupContainerTests.swift
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
@testable import MEGA
import MEGASDKRepo
import XCTest
class AppGroupContainerTests: XCTestCase {
private let url = URL(string: "http://mega.nz")
private lazy var sut = AppGroupContainer(fileManager: MockFileManager(containerURL: url!))
func testConatainerURL() throws {
XCTAssertEqual(sut.url, try XCTUnwrap(url))
}
func testDirectoryURLs() throws {
for directory in AppGroupContainer.Directory.allCases {
let directoryURL = sut.url(for: directory)
switch directory {
case .cache:
XCTAssertEqual(directoryURL, try XCTUnwrap(url?.appendingPathComponent("Library/Caches", isDirectory: true)))
case .shareExtension:
XCTAssertEqual(directoryURL, try XCTUnwrap(url?.appendingPathComponent("Share Extension Storage", isDirectory: true)))
case .fileExtension:
XCTAssertEqual(directoryURL, try XCTUnwrap(url?.appendingPathComponent("File Provider Storage", isDirectory: true)))
case .logs:
XCTAssertEqual(directoryURL, try XCTUnwrap(url?.appendingPathComponent("logs", isDirectory: true)))
case .groupSupport:
XCTAssertEqual(directoryURL, try XCTUnwrap(url?.appendingPathComponent("GroupSupport", isDirectory: true)))
}
}
}
}