38 lines
1.0 KiB
Swift
38 lines
1.0 KiB
Swift
import XCTest
|
|
@testable import MealMood
|
|
|
|
final class TagLocalizationTests: XCTestCase {
|
|
|
|
func testLocalizedNameUsesEnglishWhenAvailable() {
|
|
let tag = Tag(
|
|
name: "Carne",
|
|
nameEN: "Meat",
|
|
color: "#E74C3C"
|
|
)
|
|
|
|
XCTAssertEqual(tag.localizedName(language: .spanish), "Carne")
|
|
XCTAssertEqual(tag.localizedName(language: .english), "Meat")
|
|
}
|
|
|
|
func testLocalizedRulesDescriptionChangesByLanguage() {
|
|
let tag = Tag(
|
|
name: "Carne",
|
|
nameEN: "Meat",
|
|
color: "#E74C3C",
|
|
maxPerWeek: 3,
|
|
noConsecutive: true,
|
|
noDuplicateInDay: true,
|
|
mealTypeRestriction: "dinner"
|
|
)
|
|
|
|
let es = tag.localizedRulesDescription(language: .spanish)
|
|
let en = tag.localizedRulesDescription(language: .english)
|
|
|
|
XCTAssertTrue(es.contains("Max 3/semana"))
|
|
XCTAssertTrue(es.contains("solo cena"))
|
|
XCTAssertTrue(en.contains("Max 3/week"))
|
|
XCTAssertTrue(en.contains("dinner only"))
|
|
}
|
|
}
|
|
|