Files
resgen.swift/Tests/ResgenSwiftTests/Generate/ImagesConfigurationTests.swift
Thibaut Schmitt 7162f13166
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Add visibility parameters to control scope of generated extension
2025-07-18 11:53:46 +02:00

89 lines
2.4 KiB
Swift

//
// ImagesConfigurationTests.swift
//
//
// Created by Thibaut Schmitt on 04/11/2022.
//
import Foundation
import XCTest
@testable import ResgenSwift
final class ImagesConfigurationTests: XCTestCase {
let projectDirectory = "projectDirectory/"
func test_argsGeneration_requiredArgs() {
// Given
let testingConfiguration = ImagesConfiguration(
inputFile: "path/to/images.txt",
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: nil,
extensionName: nil,
extensionNameUIKit: nil,
extensionSuffix: nil,
visibility: nil,
staticMembers: nil
)
// When
let arguments = testingConfiguration.getArguments(
projectDirectory: projectDirectory,
force: false
)
// Expect
let expectedArguments = [
"projectDirectory/path/to/images.txt",
"--xcassets-path",
"projectDirectory/path/to/assets.xcassets"
]
XCTAssertEqual(arguments, expectedArguments)
}
func test_argsGeneration_allArguments() {
// Given
let testingConfiguration = ImagesConfiguration(
inputFile: "path/to/images.txt",
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: "Images/Generated",
extensionName: "AppUIImage",
extensionNameUIKit: "AppImage",
extensionSuffix: "Testing",
visibility: "private",
staticMembers: true
)
// When
let arguments = testingConfiguration.getArguments(
projectDirectory: projectDirectory,
force: true
)
// Expect
let expectedArguments = [
"-f",
"projectDirectory/path/to/images.txt",
"--xcassets-path",
"projectDirectory/path/to/assets.xcassets",
"--extension-output-path",
"projectDirectory/Images/Generated",
"--extension-name",
"AppUIImage",
"--extension-name-ui-kit",
"AppImage",
"--extension-suffix",
"Testing",
"--visibility",
"private",
"--static-members",
"true"
]
XCTAssertEqual(arguments, expectedArguments)
}
}