-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure file extension mocks are matching correctly (#95)
* Make sure file extension mocks are matching correctly * Remove whitespace
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// MockTests.swift | ||
// | ||
// | ||
// Created by Antoine van der Lee on 21/04/2021. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
@testable import Mocker | ||
|
||
final class MockTests: XCTestCase { | ||
override func setUp() { | ||
super.setUp() | ||
Mocker.mode = .optout | ||
} | ||
|
||
override func tearDown() { | ||
Mocker.removeAll() | ||
Mocker.mode = .optout | ||
super.tearDown() | ||
} | ||
|
||
/// It should match two file extension mocks correctly. | ||
func testFileExtensionMocksComparing() { | ||
let mock200 = Mock(fileExtensions: "png", dataType: .imagePNG, statusCode: 200, data: [.put: Data()]) | ||
let secondMock200 = Mock(fileExtensions: "png", dataType: .imagePNG, statusCode: 200, data: [.put: Data()]) | ||
let mock400 = Mock(fileExtensions: "png", dataType: .imagePNG, statusCode: 400, data: [.put: Data()]) | ||
let mockJPEG = Mock(fileExtensions: "jpeg", dataType: .imagePNG, statusCode: 200, data: [.put: Data()]) | ||
|
||
XCTAssertEqual(mock200, secondMock200) | ||
XCTAssertEqual(mock200, mock400) | ||
XCTAssertNotEqual(mock200, mockJPEG) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters