mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 20:10:08 +02:00
👌 Add feature test for InternalSwitcher
This commit is contained in:
49
tests/feature/FeatureTestCase.swift
Normal file
49
tests/feature/FeatureTestCase.swift
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// FeatureTestCase.swift
|
||||
// Feature Tests
|
||||
//
|
||||
// Created by Nico Verbruggen on 07/11/2022.
|
||||
// Copyright © 2022 Nico Verbruggen. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
class FeatureTestCase: XCTestCase {
|
||||
|
||||
var fakeFileSystem: TestableFileSystem {
|
||||
let fs = ActiveFileSystem.shared
|
||||
|
||||
if fs is TestableFileSystem {
|
||||
return fs as! TestableFileSystem
|
||||
}
|
||||
|
||||
fatalError("The active filesystem is not a TestableFileSystem. Please use `ActiveFileSystem` to use the fake filesystem.")
|
||||
}
|
||||
|
||||
public func assertFileSystemHas(
|
||||
_ path: String,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line
|
||||
) {
|
||||
XCTAssertTrue(fakeFileSystem.files.keys.contains(path), file: file, line: line)
|
||||
}
|
||||
|
||||
public func assertFileSystemDoesNotHave(
|
||||
_ path: String,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line
|
||||
) {
|
||||
XCTAssertFalse(fakeFileSystem.files.keys.contains(path), file: file, line: line)
|
||||
}
|
||||
|
||||
public func assertFileHasContents(
|
||||
_ path: String,
|
||||
contents: String,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line
|
||||
) {
|
||||
XCTAssertEqual(contents, fakeFileSystem.files[path]?.content, file: file, line: line)
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user