in FBAEMKit/FBAEMKitTests/AEMConfigurationTests.swift [163:224]
func testInvalidCases() {
var invalidData: [String: Any] = [:]
XCTAssertNil(_AEMConfiguration(json: invalidData))
invalidData = [
Keys.defaultCurrency: 100,
Keys.cutoffTime: 1,
Keys.validFrom: 10000,
Keys.configMode: Values.defaultMode,
Keys.conversionValueRules: [
[
Keys.conversionValue: 2,
Keys.priority: 10,
Keys.events: [
[
Keys.eventName: Values.purchase,
],
[
Keys.eventName: Values.donate,
],
],
],
],
]
XCTAssertNil(
_AEMConfiguration(json: invalidData),
"Should not consider the config json valid with unexpected type for default_currency"
)
invalidData = [
Keys.defaultCurrency: Values.USD,
Keys.cutoffTime: 1,
Keys.validFrom: 10000,
Keys.configMode: Values.defaultMode,
]
XCTAssertNil(
_AEMConfiguration(json: invalidData),
"Should not consider the config json valid without any conversion value rules"
)
invalidData = [
Keys.defaultCurrency: Values.USD,
Keys.cutoffTime: 1,
Keys.validFrom: 10000,
Keys.configMode: Values.defaultMode,
Keys.conversionValueRules: [
[
Keys.conversionValue: "2",
Keys.priority: 10,
Keys.events: [
[
Keys.eventName: Values.purchase,
],
[
Keys.eventName: Values.donate,
],
],
],
],
]
XCTAssertNil(
_AEMConfiguration(json: invalidData),
"Should not consider the config json valid with invalid conversion value rule"
)
}