Skip to content

Commit

Permalink
Исправлены unit тесты
Browse files Browse the repository at this point in the history
  • Loading branch information
timbaev committed Feb 7, 2024
1 parent e328651 commit 7dafec5
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions Tests/FigmaGenTests/TokensResolverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ final class TokensResolverTests: XCTestCase {
semantic: [],
colors: [],
typography: [],
day: [],
night: []
hhDay: [],
hhNight: [],
zpDay: []
)

let value = "{core.space.1-x} + {core.space.1-x} / 2"
Expand Down Expand Up @@ -64,8 +65,9 @@ final class TokensResolverTests: XCTestCase {
TokenValue(type: .core(value: "#ffffff"), name: "color.base.white")
],
typography: [],
day: [],
night: []
hhDay: [],
hhNight: [],
zpDay: []
)

let value = "rgba({color.base.white}, {semantic.opacity.disabled})"
Expand Down Expand Up @@ -97,8 +99,9 @@ final class TokensResolverTests: XCTestCase {
TokenValue(type: .color(value: "#d64030"), name: "color.base.red.50")
],
typography: [],
day: [],
night: []
hhDay: [],
hhNight: [],
zpDay: []
)

let firstColor = "rgba({color.base.red.50}, {semantic.opacity.transparent})"
Expand Down Expand Up @@ -187,8 +190,9 @@ final class TokensResolverTests: XCTestCase {
TokenValue(type: .color(value: "#111"), name: "color.base.gray.5")
],
typography: [],
day: [],
night: []
hhDay: [],
hhNight: [],
zpDay: []
)

let value1 = "rgba({color.base.white}, {semantic.opacity.disabled})"
Expand Down Expand Up @@ -221,17 +225,18 @@ final class TokensResolverTests: XCTestCase {
TokenValue(type: .color(value: "#000000"), name: "color.base.black")
],
typography: [],
day: [],
night: [
hhDay: [],
hhNight: [
TokenValue(type: .color(value: "{color.base.black}"), name: "color.background.primary"),
TokenValue(type: .color(value: "{color.background.primary}"), name: "color.background.primary.nested")
]
],
zpDay: []
)

let value = "{color.background.primary.nested}"
let expectedBaseReference = "{color.base.black}"

let actualBaseReference = try tokensResolver.resolveBaseReference(value, tokenValues: tokenValues.night)
let actualBaseReference = try tokensResolver.resolveBaseReference(value, tokenValues: tokenValues.hhNight)

XCTAssertEqual(actualBaseReference, expectedBaseReference)
}
Expand All @@ -248,17 +253,18 @@ final class TokensResolverTests: XCTestCase {
TokenValue(type: .color(value: "#000000"), name: "color.base.black")
],
typography: [],
day: [],
night: [
hhDay: [],
hhNight: [
TokenValue(type: .color(value: "{color.base.black}"), name: "color.background.primary"),
TokenValue(type: .color(value: "{color.background.primary}"), name: "color.background.primary.nested")
]
],
zpDay: []
)

let value = "rgba( {color.background.primary.nested}, {semantic.opacity.disabled})"
let expectedBaseReference = "rgba( {color.base.black}, {semantic.opacity.disabled})"

let actualBaseReference = try tokensResolver.resolveBaseReference(value, tokenValues: tokenValues.night)
let actualBaseReference = try tokensResolver.resolveBaseReference(value, tokenValues: tokenValues.hhNight)

XCTAssertEqual(actualBaseReference, expectedBaseReference)
}
Expand All @@ -273,8 +279,9 @@ extension TokenValues {
semantic: [],
colors: [],
typography: [],
day: [],
night: []
hhDay: [],
hhNight: [],
zpDay: []
)
}
#endif

0 comments on commit 7dafec5

Please sign in to comment.