Skip to content

Commit 140c4cb

Browse files
chrisbobbegnprice
authored andcommitted
emoji test [nfc]: Make a nested prepare more like another (1/2)
We'd like to deduplicate and share this setup code.
1 parent bf60af5 commit 140c4cb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/model/emoji_test.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,21 @@ void main() {
324324

325325
PerAccountStore prepare({
326326
Map<String, String> realmEmoji = const {},
327+
bool addServerDataForPopular = true,
327328
Map<String, List<String>>? unicodeEmoji,
328329
}) {
329330
final store = eg.store(
330331
initialSnapshot: eg.initialSnapshot(realmEmoji: {
331332
for (final MapEntry(:key, :value) in realmEmoji.entries)
332333
key: eg.realmEmojiItem(emojiCode: key, emojiName: value),
333334
}));
334-
final extraEmojiData = ServerEmojiData(codeToNames: unicodeEmoji ?? {});
335-
ServerEmojiData emojiData = eg.serverEmojiDataPopularPlus(extraEmojiData);
336-
store.setServerEmojiData(emojiData);
335+
if (addServerDataForPopular || unicodeEmoji != null) {
336+
final extraEmojiData = ServerEmojiData(codeToNames: unicodeEmoji ?? {});
337+
final emojiData = addServerDataForPopular
338+
? eg.serverEmojiDataPopularPlus(extraEmojiData)
339+
: extraEmojiData;
340+
store.setServerEmojiData(emojiData);
341+
}
337342
return store;
338343
}
339344

0 commit comments

Comments
 (0)