//
//  AnalyticsConfigurationTests.swift
//  ResgenSwift
//
//  Created by Thibaut Schmitt on 18/07/2025.
//

import Foundation
@testable import ResgenSwift
import XCTest

final class AnalyticsConfigurationTests: XCTestCase {

    let projectDirectory = "projectDirectory/"
    
    func test_argsGeneration_requiredArgs() {
        // Given
        let testingConfiguration = AnalyticsConfiguration(
            inputFile: "path/to/tags.yml",
            target: "matomo firebase",
            outputFile: "Analytics/Generated/AnalyticsManager.swift",
            visibility: nil,
            staticMembers: nil
        )

        // When
        let arguments = testingConfiguration.getArguments(
            projectDirectory: projectDirectory,
            force: false
        )
                
        // Expect
        let expectedArguments = [
            "projectDirectory/path/to/tags.yml",
            "--target",
            "matomo firebase",
            "--output-file",
            "projectDirectory/Analytics/Generated/AnalyticsManager.swift",
        ]

        XCTAssertEqual(arguments, expectedArguments)
    }
    
    func test_argsGeneration_allArguments() {
        // Given
        let testingConfiguration = AnalyticsConfiguration(
            inputFile: "path/to/tags.yml",
            target: "matomo firebase",
            outputFile: "Analytics/Generated/AnalyticsManager.swift",
            visibility: "public",
            staticMembers: false
        )

        // When
        let arguments = testingConfiguration.getArguments(
            projectDirectory: projectDirectory,
            force: true
        )

        // Expect
        let expectedArguments = [
            "-f",
            "projectDirectory/path/to/tags.yml",
            "--target",
            "matomo firebase",
            "--output-file",
            "projectDirectory/Analytics/Generated/AnalyticsManager.swift",
            "--visibility",
            "public",
            "--static-members",
            "false"
        ]

        XCTAssertEqual(arguments, expectedArguments)
    }
}
