Skip to content

Commit b144d62

Browse files
chrisbobbegnprice
authored andcommitted
test: Populate eg.initialSnapshot.realmCanDeleteOwnMessageGroup by default
But only when we're simulating recent servers, as the comment says. (FL 291 removed realmDeleteOwnMessagePolicy and added realmCanDeleteOwnMessageGroup, so to be representative, tests should always specify one but not the other.)
1 parent da32714 commit b144d62

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/example_data.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,13 @@ InitialSnapshot initialSnapshot({
12851285
List<User>? realmNonActiveUsers,
12861286
List<User>? crossRealmBots,
12871287
}) {
1288+
if (realmDeleteOwnMessagePolicy == null) {
1289+
// Set a default for realmCanDeleteOwnMessageGroup, but only if we're
1290+
// trying to simulate a modern server without realmDeleteOwnMessagePolicy.
1291+
realmCanDeleteOwnMessageGroup ??= GroupSettingValueNamed(nobodyGroup.id);
1292+
}
1293+
assert((realmCanDeleteOwnMessageGroup != null) ^ (realmDeleteOwnMessagePolicy != null));
1294+
12881295
return InitialSnapshot(
12891296
queueId: queueId ?? '1:2345',
12901297
lastEventId: lastEventId ?? -1,
@@ -1320,7 +1327,6 @@ InitialSnapshot initialSnapshot({
13201327
userTopics: userTopics,
13211328
// no default; allow `null` to simulate servers without this
13221329
realmCanDeleteAnyMessageGroup: realmCanDeleteAnyMessageGroup,
1323-
// no default; allow `null` to simulate servers without this
13241330
realmCanDeleteOwnMessageGroup: realmCanDeleteOwnMessageGroup,
13251331
realmDeleteOwnMessagePolicy: realmDeleteOwnMessagePolicy,
13261332
realmWildcardMentionPolicy: realmWildcardMentionPolicy ?? RealmWildcardMentionPolicy.everyone,

0 commit comments

Comments
 (0)