Files
resgen.swift/Tests/ResgenSwiftTests/Generate/ColorsConfigurationTests.swift
T
t.schmitt 58b049c629
openium/resgen.swift/pipeline/head This commit looks good
Migrate tests from XCTest to Swift Testing (#26)
Reviewed-on: #26
2026-11-23 16:25:37 +01:00

100 lines
2.7 KiB
Swift

//
// ColorsConfigurationTests.swift
//
//
// Created by Thibaut Schmitt on 04/11/2022.
//
import Foundation
import Testing
@testable import ResgenSwift
struct ColorsConfigurationTests {
let projectDirectory = "projectDirectory/"
@Test
func argsGeneration_requiredArgs() {
// Given
let testingConfiguration = ColorsConfiguration(
inputFile: "path/to/colors.txt",
style: ColorStyle.all.rawValue,
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: nil,
extensionName: nil,
extensionNameUIKit: nil,
extensionSuffix: nil,
visibility: nil,
assetBundle: nil,
staticMembers: false
)
// When
let arguments = testingConfiguration.getArguments(
projectDirectory: projectDirectory,
force: false
)
// Expect
let expectedArguments = [
"projectDirectory/path/to/colors.txt",
"--style",
"all",
"--xcassets-path",
"projectDirectory/path/to/assets.xcassets",
"--static-members",
"false"
]
#expect(arguments == expectedArguments)
}
@Test
func argsGeneration_allArguments() {
// Given
let testingConfiguration = ColorsConfiguration(
inputFile: "path/to/colors.txt",
style: ColorStyle.all.rawValue,
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: "Colors/Generated",
extensionName: "AppUIColor",
extensionNameUIKit: "AppColor",
extensionSuffix: "Testing",
visibility: "public",
assetBundle: "module",
staticMembers: false
)
// When
let arguments = testingConfiguration.getArguments(
projectDirectory: projectDirectory,
force: true
)
// Expect
let expectedArguments = [
"-f",
"projectDirectory/path/to/colors.txt",
"--style",
"all",
"--xcassets-path",
"projectDirectory/path/to/assets.xcassets",
"--extension-output-path",
"projectDirectory/Colors/Generated",
"--extension-name",
"AppUIColor",
"--extension-name-ui-kit",
"AppColor",
"--extension-suffix",
"Testing",
"--visibility",
"public",
"--asset-bundle",
"module",
"--static-members",
"false"
]
#expect(arguments == expectedArguments)
}
}