Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: skip feature version checking in the e2e tests #97

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions BucketeerTests/E2E/E2EEvaluationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.stringVariationDetails(featureId: FEATURE_ID_STRING, defaultValue: "default"),
.init(
assertEvaluationDetails(
actual: client.stringVariationDetails(featureId: FEATURE_ID_STRING, defaultValue: "default"),
expected: .init(
featureId: FEATURE_ID_STRING,
featureVersion: 3,
userId: USER_ID,
Expand All @@ -66,9 +66,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.objectVariationDetails(featureId: FEATURE_ID_STRING, defaultValue: .list([])),
.init(
assertEvaluationDetails(
actual: client.objectVariationDetails(featureId: FEATURE_ID_STRING, defaultValue: .list([])),
expected: .init(
featureId: FEATURE_ID_STRING,
featureVersion: 3,
userId: USER_ID,
Expand Down Expand Up @@ -105,9 +105,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.intVariationDetails(featureId: FEATURE_ID_INT, defaultValue: 1),
.init(
assertEvaluationDetails(
actual: client.intVariationDetails(featureId: FEATURE_ID_INT, defaultValue: 1),
expected: .init(
featureId: FEATURE_ID_INT,
featureVersion: 4,
userId: USER_ID,
Expand All @@ -117,9 +117,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.objectVariationDetails(featureId: FEATURE_ID_INT, defaultValue: .number(1)),
.init(
assertEvaluationDetails(
actual: client.objectVariationDetails(featureId: FEATURE_ID_INT, defaultValue: .number(1)),
expected: .init(
featureId: FEATURE_ID_INT,
featureVersion: 4,
userId: USER_ID,
Expand Down Expand Up @@ -157,9 +157,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.doubleVariationDetails(featureId: FEATURE_ID_DOUBLE, defaultValue: 1.1),
.init(
assertEvaluationDetails(
actual: client.doubleVariationDetails(featureId: FEATURE_ID_DOUBLE, defaultValue: 1.1),
expected: .init(
featureId: FEATURE_ID_DOUBLE,
featureVersion: 3,
userId: USER_ID,
Expand All @@ -169,9 +169,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.intVariationDetails(featureId: FEATURE_ID_DOUBLE, defaultValue: 1),
.init(
assertEvaluationDetails(
actual: client.intVariationDetails(featureId: FEATURE_ID_DOUBLE, defaultValue: 1),
expected: .init(
featureId: FEATURE_ID_DOUBLE,
featureVersion: 3,
userId: USER_ID,
Expand All @@ -181,9 +181,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.objectVariationDetails(featureId: FEATURE_ID_DOUBLE, defaultValue: .number(1.1)),
.init(
assertEvaluationDetails(
actual: client.objectVariationDetails(featureId: FEATURE_ID_DOUBLE, defaultValue: .number(1.1)),
expected: .init(
featureId: FEATURE_ID_DOUBLE,
featureVersion: 3,
userId: USER_ID,
Expand Down Expand Up @@ -220,9 +220,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.boolVariationDetails(featureId: FEATURE_ID_BOOLEAN, defaultValue: false),
.init(
assertEvaluationDetails(
actual: client.boolVariationDetails(featureId: FEATURE_ID_BOOLEAN, defaultValue: false),
expected: .init(
featureId: FEATURE_ID_BOOLEAN,
featureVersion: 3,
userId: USER_ID,
Expand All @@ -232,9 +232,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.objectVariationDetails(featureId: FEATURE_ID_BOOLEAN, defaultValue: .boolean(false)),
.init(
assertEvaluationDetails(
actual: client.objectVariationDetails(featureId: FEATURE_ID_BOOLEAN, defaultValue: .boolean(false)),
expected: .init(
featureId: FEATURE_ID_BOOLEAN,
featureVersion: 3,
userId: USER_ID,
Expand Down Expand Up @@ -272,9 +272,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .default
))

XCTAssertEqual(
client.objectVariationDetails(featureId: FEATURE_ID_JSON, defaultValue: .dictionary([:])),
.init(
assertEvaluationDetails(
actual: client.objectVariationDetails(featureId: FEATURE_ID_JSON, defaultValue: .dictionary([:])),
expected: .init(
featureId: FEATURE_ID_JSON,
featureVersion: 3,
userId: USER_ID,
Expand Down Expand Up @@ -309,9 +309,9 @@ final class E2EEvaluationTests: XCTestCase {
reason: .rule
))

XCTAssertEqual(
client.objectVariationDetails(featureId: FEATURE_ID_STRING, defaultValue: .number(1.0)),
.init(
assertEvaluationDetails(
actual: client.objectVariationDetails(featureId: FEATURE_ID_STRING, defaultValue: .number(1.0)),
expected: .init(
featureId: FEATURE_ID_STRING,
featureVersion: 3,
userId: USER_ID,
Expand Down
14 changes: 14 additions & 0 deletions BucketeerTests/E2E/E2ETestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,20 @@ func assertEvaluation(actual: BKTEvaluation?, expected: BKTEvaluationExpected, f
}
}

func assertEvaluationDetails<T>(
actual: BKTEvaluationDetails<T>,
expected: BKTEvaluationDetails<T>
) {
// Skipped check on the feature version
let isEqual = actual.featureId == expected.featureId &&
actual.userId == expected.userId &&
actual.variationId == expected.variationId &&
actual.variationName == expected.variationName &&
actual.reason == expected.reason &&
actual.variationValue == expected.variationValue
XCTAssertTrue(isEqual)
}

final class E2ELogger: BKTLogger {
private var prefix: String {
"Bucketeer E2E "
Expand Down
Loading