<commit_before>import XCTest
@testable import MastodonKit

class RequestErrorTests: XCTestCase {
    static var allTests = [
        ("testErrorFromJSON", testErrorFromJSON)
    ]

    var errorFixture: Any!

    override func setUp() {
        super.setUp()
        errorFixture = try? Fixture.load(fileName: "Fixtures/RequestError.json")
    }

    func testErrorFromJSON() {
        let dictionary = errorFixture as! JSONDictionary
        let requestError = RequestError(json: dictionary)

        switch requestError {
        case .apiError(let reason):
            XCTAssertEqual(reason, "yes, it's an error.")
            break
        }
    }
}
<commit_msg>Adds another test to error model<commit_after>import XCTest
@testable import MastodonKit

class RequestErrorTests: XCTestCase {
    static var allTests = [
        ("testErrorWithValidJSON", testErrorWithValidJSON),
        ("testErrorWithInvalidJSON", testErrorWithInvalidJSON)
    ]

    var errorFixture: Any!

    override func setUp() {
        super.setUp()
        errorFixture = try? Fixture.load(fileName: "Fixtures/RequestError.json")
    }

    func testErrorWithValidJSON() {
        let dictionary = errorFixture as! JSONDictionary
        let requestError = RequestError(json: dictionary)

        switch requestError {
        case .apiError(let reason):
            XCTAssertEqual(reason, "yes, it's an error.")
            break
        }
    }

    func testErrorWithInvalidJSON() {
        let requestError = RequestError(json: [:])

        switch requestError {
        case .apiError(let reason):
            XCTAssertNil(reason)
            break
        }
    }
}

{'fraction_non_alphanumeric': 0.08524788391777509, 'fraction_numerical': 0.0, 'mean_word_length': 2.4842105263157896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2270287', 'n_tokens_mistral': 471, 'n_tokens_neox': 458, 'n_words': 111}