Skip to content

Commit 5f45aa0

Browse files
Add check for expriement id and variation id into decision info payload
1 parent 4f4eacf commit 5f45aa0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/src/utils/constants.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ class Constants {
6262
static const String userContextId = "userContextId";
6363
static const String userContext = "userContext";
6464
static const String experiment = "experiment";
65+
static const String experimentId = "experimentId";
6566
static const String variation = "variation";
67+
static const String variationId = "variationId";
6668
static const String userId = "userId";
6769
static const String vuid = "vuid";
6870
static const String experimentKey = "experimentKey";

test/test_utils.dart

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,14 @@ class TestUtils {
8989
handler(MethodCall(Constants.decisionCallBackListener, {
9090
Constants.id: id,
9191
Constants.sdkKey: sdkKey,
92-
Constants.payload: {Constants.type: "$id", Constants.userId: "test"}
92+
Constants.payload: <String, Object>{
93+
Constants.type: "$id",
94+
Constants.userId: "test",
95+
Constants.decisionInfo: const {
96+
Constants.experimentId: "experiment_12345",
97+
Constants.variationId: "variation_12345",
98+
},
99+
}
93100
}));
94101
}
95102

@@ -179,7 +186,11 @@ class TestUtils {
179186
static bool testDecisionNotificationPayload(
180187
List notifications, int id, int actualID) {
181188
if (notifications[id].type != "$actualID" ||
182-
notifications[id].userId != "test") {
189+
notifications[id].userId != "test" ||
190+
notifications[id].decisionInfo[Constants.experimentId] !=
191+
"experiment_12345" ||
192+
notifications[id].decisionInfo[Constants.variationId] !=
193+
"variation_12345") {
183194
return false;
184195
}
185196
return true;

0 commit comments

Comments
 (0)