mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
79 lines
2.6 KiB
Swift
79 lines
2.6 KiB
Swift
import XCTest
|
|
|
|
final class ComplexPropertyTests: XCTestCase {
|
|
func test_RequiredComplexProperty_WithLink() throws {
|
|
let entity = try readEntity("test_complex_property_with_link")
|
|
|
|
XCTAssertEqual(entity, ExpectedEntities.withRequiredComplexProperty)
|
|
}
|
|
|
|
func test_RequiredComplexProperty_WithoutLink() throws {
|
|
let entity = try readEntity("test_complex_property_without_link")
|
|
|
|
XCTAssertEqual(entity, ExpectedEntities.withRequiredComplexProperty)
|
|
}
|
|
|
|
func test_RequiredComplexProperty_WithInternalLink() throws {
|
|
let entity = try readEntity("test_complex_property_with_internal_link")
|
|
|
|
XCTAssertEqual(entity, ExpectedEntities.withRequiredComplexProperty)
|
|
}
|
|
|
|
func test_ComplexProperty_WithLinkToInternalLink() throws {
|
|
let entity = try readEntity("test_complex_property_with_link_to_internal_link")
|
|
|
|
// DIVKIT-54: link to link is not supported
|
|
// XCTAssertEqual(entity, Expected.withRequiredComplexProperty)
|
|
XCTAssertNil(entity)
|
|
}
|
|
|
|
func test_RequiredComplexProperty_WithInternalLinkOverrideInTemplate() throws {
|
|
let entity = try readEntity("test_complex_property_with_internal_link_override_in_template")
|
|
|
|
XCTAssertEqual(entity, ExpectedEntities.withRequiredComplexProperty)
|
|
}
|
|
|
|
func test_WhenRequiredComplexPropertyIsMissing_WithLink_NoValue() throws {
|
|
let entity = try readEntity("test_complex_property_with_link_missing_data")
|
|
|
|
XCTAssertNil(entity)
|
|
}
|
|
|
|
func test_WhenRequiredComplexPropertyIsMissing_WithoutLink_NoValue() throws {
|
|
let entity = try readEntity("test_complex_property_without_link_missing_data")
|
|
|
|
XCTAssertNil(entity)
|
|
}
|
|
|
|
func test_WhenRequiredComplexPropertyIsMissing_WithInternalLink_NoValue() throws {
|
|
let entity = try readEntity("test_complex_property_with_internal_link_missing_data")
|
|
|
|
XCTAssertNil(entity)
|
|
}
|
|
|
|
func test_RequiredComplexProperty_NotTemplated() throws {
|
|
let entity = try readEntity("test_complex_property_not_templated")
|
|
|
|
XCTAssertEqual(entity, ExpectedEntities.withRequiredComplexProperty)
|
|
}
|
|
|
|
func test_RequiredComplexProperty_WithOverrideInTemplate() throws {
|
|
let entity = try readEntity("test_complex_property_with_override_in_template")
|
|
|
|
XCTAssertEqual(entity, ExpectedEntities.withRequiredComplexProperty)
|
|
}
|
|
|
|
func test_InvalidRequiredComplexProperty_NoValue() throws {
|
|
let entity = try readEntity("test_invalid_complex_property_not_templated")
|
|
|
|
XCTAssertNil(entity)
|
|
}
|
|
}
|
|
|
|
private func readEntity(_ fileName: String) throws -> EntityWithComplexProperty? {
|
|
try readEntity(
|
|
EntityWithComplexPropertyTemplate.self,
|
|
fileName: "complex_property/\(fileName)"
|
|
)
|
|
}
|