<commit_before>import Foundation
import XCTest
@testable import SwiftyVK

final class DependenciesTests: XCTestCase {
    
    func test_makeAuthorizator_typeIsAuthorizatorImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.authorizator
        // Then
        XCTAssertTrue(type(of: object) == AuthorizatorImpl.self)
    }
    
    func test_makeAttempt_typeIsAttemptImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.attempt(request: URLRequest(url: URL(fileURLWithPath: "")), callbacks: .default)
        // Then
        XCTAssertTrue(type(of: object) == AttemptImpl.self)
    }
    
    func test_makeSession_typeIsSessionImpl() {
        // Given
        let context = makeContext()
        context.factory.sessionsStorage = SessionsStorageMock()
        context.factory.authorizator = AuthorizatorMock()
        // When
        let object = context.factory.session(id: "", config: .default, sessionSaver: SessionsHolderMock())
        // Then
        XCTAssertTrue(type(of: object) == SessionImpl.self)
    }
    
    func test_makeWebController_typeIsWebControllerPLATFORM() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.webController(onDismiss: nil)
        // Then
        #if os(iOS)
            XCTAssertTrue(type(of: object) == WebControllerIOS.self)
        #elseif os(macOS)
            XCTAssertTrue(type(of: object) == WebControllerMacOS.self)
        #endif
    }
    
    func test_makeCaptchaController_typeIsCaptchaControllerPLATFORM() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.captchaController(onDismiss: nil)
        // Then
        #if os(iOS)
            XCTAssertTrue(type(of: object) == CaptchaControllerIOS.self)
        #elseif os(macOS)
            XCTAssertTrue(type(of: object) == CaptchaControllerMacOS.self)
        #endif
    }
    
    func test_makeTask_typeIsTaskImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.task(request: Request(type: .url("")), session: SessionMock())
        // Then
        XCTAssertTrue(type(of: object) == TaskImpl.self)
    }
    
    func test_makeLongPollTask_typeIsLongPollTaskImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.longPollTask(
            session: SessionMock(),
            data: LongPollTaskData(server: "", startTs: "", lpKey: "", onResponse: { _ in }, onError: { _ in } )
        )
        // Then
        XCTAssertTrue(type(of: object) == LongPollTaskImpl.self)
    }
    
    func test_makeLongPoll_typeIsLongPollImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.longPoll(session: SessionMock())
        // Then
        XCTAssertTrue(type(of: object) == LongPollImpl.self)
    }
    
    func test_makeToken_typeIsTokenImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.token(token: "", expires: 0, info: [:])
        // Then
        XCTAssertTrue(type(of: object) == TokenImpl.self)
    }
}

private func makeContext() -> (factory: DependenciesImpl, delegate: SwiftyVKDelegateMock) {
    let delegate = SwiftyVKDelegateMock()
    let factory = DependenciesImpl(appId: "123", delegate: delegate)
    
    return (factory, delegate)
}<commit_msg>[tests] Improve code coverage<commit_after>import Foundation
import XCTest
@testable import SwiftyVK

final class DependenciesTests: XCTestCase {
    
    func test_makeAuthorizator_typeIsAuthorizatorImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.authorizator
        // Then
        XCTAssertTrue(type(of: object) == AuthorizatorImpl.self)
    }
    
    func test_makeAttempt_typeIsAttemptImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.attempt(request: URLRequest(url: URL(fileURLWithPath: "")), callbacks: .default)
        // Then
        XCTAssertTrue(type(of: object) == AttemptImpl.self)
    }
    
    func test_makeSession_typeIsSessionImpl() {
        // Given
        let context = makeContext()
        context.factory.sessionsStorage = SessionsStorageMock()
        context.factory.authorizator = AuthorizatorMock()
        // When
        let object = context.factory.session(id: "", config: .default, sessionSaver: SessionsHolderMock())
        // Then
        XCTAssertTrue(type(of: object) == SessionImpl.self)
    }
    
    func test_makeWebController_typeIsWebControllerPLATFORM() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.webController(onDismiss: nil)
        // Then
        #if os(iOS)
            XCTAssertTrue(type(of: object) == WebControllerIOS.self)
        #elseif os(macOS)
            XCTAssertTrue(type(of: object) == WebControllerMacOS.self)
        #endif
    }
    
    func test_makeCaptchaController_typeIsCaptchaControllerPLATFORM() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.captchaController(onDismiss: nil)
        // Then
        #if os(iOS)
            XCTAssertTrue(type(of: object) == CaptchaControllerIOS.self)
        #elseif os(macOS)
            XCTAssertTrue(type(of: object) == CaptchaControllerMacOS.self)
        #endif
    }
    
    func test_makeShareController_typeIsShareControllerImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.shareController(onDismiss: nil)
        // Then
        #if os(iOS)
            XCTAssertTrue(type(of: object) == ShareControllerIOS.self)
        #elseif os(macOS)
            XCTAssertTrue(type(of: object) == ShareControllerMacOS.self)
        #endif
    }
    
    func test_makeTask_typeIsTaskImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.task(request: Request(type: .url("")), session: SessionMock())
        // Then
        XCTAssertTrue(type(of: object) == TaskImpl.self)
    }
    
    func test_makeLongPollTask_typeIsLongPollTaskImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.longPollTask(
            session: SessionMock(),
            data: LongPollTaskData(server: "", startTs: "", lpKey: "", onResponse: { _ in }, onError: { _ in } )
        )
        // Then
        XCTAssertTrue(type(of: object) == LongPollTaskImpl.self)
    }
    
    func test_makeLongPoll_typeIsLongPollImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.longPoll(session: SessionMock())
        // Then
        XCTAssertTrue(type(of: object) == LongPollImpl.self)
    }
    
    func test_makeToken_typeIsTokenImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.token(token: "", expires: 0, info: [:])
        // Then
        XCTAssertTrue(type(of: object) == TokenImpl.self)
    }
    
    func test_makeSharePresenter_typeIsSharePresenterImpl() {
        // Given
        let context = makeContext()
        // When
        let object = context.factory.sharePresenter()
        // Then
        XCTAssertTrue(type(of: object) == SharePresenterImpl.self)
    }
}

private func makeContext() -> (factory: DependenciesImpl, delegate: SwiftyVKDelegateMock) {
    let delegate = SwiftyVKDelegateMock()
    let factory = DependenciesImpl(appId: "123", delegate: delegate)
    
    return (factory, delegate)
}
{'fraction_non_alphanumeric': 0.10604318385077297, 'fraction_numerical': 0.0010221029768749201, 'mean_word_length': 2.241407867494824, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5547418', 'n_tokens_mistral': 2279, 'n_tokens_neox': 2245, 'n_words': 448}