<commit_before>//
//  MIMEResolverTests.swift
//  MIMEResolverTests
//
//  Created by <NAME> on 10/14/16.
//  Copyright © 2016 Inloop, s.r.o. All rights reserved.
//

import XCTest
@testable import MIMEResolver

class MockMIME: MIME {
    var signature: [UInt8]
    var contentType: String

    init(signature: [UInt8] = [0x49, 0x4e, 0x4c, 0x4f, 0x4f, 0x50],
         contentType: String = "test/mock") {
        self.signature = signature
        self.contentType = contentType
    }
}

class MIMEResolverTests: XCTestCase {

    func testResolveNotNil() {
        let mock = MockMIME()
        let data = Data(bytes: mock.signature)
        let resolver = MIMEResolver()
        resolver.register(mimeType: mock)
        let resolved = resolver.resolve(data: data)<commit_msg>Implemenet testResolverInitializedEmpty<commit_after>//
//  MIMEResolverTests.swift
//  MIMEResolverTests
//
//  Created by <NAME> on 10/14/16.
//  Copyright © 2016 Inloop, s.r.o. All rights reserved.
//

import XCTest
@testable import MIMEResolver

class MockMIME: MIME {
    var signature: [UInt8]
    var contentType: String

    init(signature: [UInt8] = [0x49, 0x4e, 0x4c, 0x4f, 0x4f, 0x50],
         contentType: String = "test/mock") {
        self.signature = signature
        self.contentType = contentType
    }
}

class MIMEResolverTests: XCTestCase {

    func testResolverInitializedEmpty() {
        let resolver = MIMEResolver()
        XCTAssertEqual(resolver.registeredTypes.count, 0)
    }

    func testResolveNotNil() {
        let mock = MockMIME()
        let data = Data(bytes: mock.signature)
        let resolver = MIMEResolver()
        resolver.register(mimeType: mock)
        let resolved = resolver.resolve(data: data)
{'fraction_non_alphanumeric': 0.10770121598147075, 'fraction_numerical': 0.030689056166763172, 'mean_word_length': 2.814569536423841, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2735099', 'n_tokens_mistral': 624, 'n_tokens_neox': 585, 'n_words': 139}