// // FontNameTests.swift // // // Created by Thibaut Schmitt on 05/09/2022. // import Foundation import XCTest @testable import ResgenSwift final class FontNameTests: XCTestCase { func testGeneratedProperty_noForbiddenCharacter() { // Given let fontName: FontName = "CircularStdBold" // When let property = fontName.staticProperty // Expect let expect = """ static let CircularStdBold: ((_ size: CGFloat) -> UIFont) = { size in UIFont(name: FontName.CircularStdBold.rawValue, size: size)! } """ XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) } func testGeneratedProperty_withForbiddenCharacter() { // Given let fontName: FontName = "[Circular_Std+Bold-Underline]" // When let property = fontName.staticProperty // Expect let expect = """ static let CircularStdBoldUnderline: ((_ size: CGFloat) -> UIFont) = { size in UIFont(name: FontName.CircularStdBoldUnderline.rawValue, size: size)! } """ XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) } func testGeneratedMethod_noForbiddenCharacter() { // Given let fontName: FontName = "CircularStdBold" // When let property = fontName.method // Expect let expect = """ func CircularStdBold(withSize size: CGFloat) -> UIFont { UIFont(name: FontName.CircularStdBold.rawValue, size: size)! } """ XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) } func testGeneratedMethod_withForbiddenCharacter() { // Given let fontName: FontName = "[Circular_Std+Bold-Underline]" // When let property = fontName.method // Expect let expect = """ func CircularStdBoldUnderline(withSize size: CGFloat) -> UIFont { UIFont(name: FontName.CircularStdBoldUnderline.rawValue, size: size)! } """ XCTAssertEqual(property.adaptForXCTest(), expect.adaptForXCTest()) } }