@@ -207,13 +207,21 @@ TEST(FlagUpdaterEventTests, SecondInitWithUpdateProducesEvents) {
207207
208208 std::atomic_bool got_event (false );
209209 notifier->OnFlagChange (
210- " flagA" , [&got_event](std::shared_ptr<FlagValueChangeEvent> event) {
210+ " flagA" , [&got_event, &manager ](std::shared_ptr<FlagValueChangeEvent> event) {
211211 got_event.store (true );
212212
213213 EXPECT_EQ (" test" , event->OldValue ().AsString ());
214214 EXPECT_EQ (" potato" , event->NewValue ().AsString ());
215215 EXPECT_EQ (" flagA" , event->FlagName ());
216216 EXPECT_FALSE (event->Deleted ());
217+
218+ // The value in the store should be consistent with the new value.
219+ EXPECT_EQ (event->NewValue ().AsString (), manager.Get (" flagA" )
220+ .get ()
221+ ->item .value ()
222+ .Detail ()
223+ .Value ()
224+ .AsString ());
217225 });
218226
219227 updater.Init (
@@ -283,13 +291,21 @@ TEST(FlagUpdaterDataTests, PatchWithUpdateProducesEvent) {
283291
284292 std::atomic_bool got_event (false );
285293 notifier->OnFlagChange (
286- " flagA" , [&got_event](std::shared_ptr<FlagValueChangeEvent> event) {
294+ " flagA" ,
295+ [&got_event, &manager](std::shared_ptr<FlagValueChangeEvent> event) {
287296 got_event.store (true );
288297
289298 EXPECT_EQ (" test" , event->OldValue ().AsString ());
290299 EXPECT_EQ (" second" , event->NewValue ().AsString ());
291300 EXPECT_EQ (" flagA" , event->FlagName ());
292301 EXPECT_FALSE (event->Deleted ());
302+ // The value in the store should be consistent with the new value.
303+ EXPECT_EQ (event->NewValue ().AsString (), manager.Get (" flagA" )
304+ .get ()
305+ ->item .value ()
306+ .Detail ()
307+ .Value ()
308+ .AsString ());
293309 });
294310
295311 updater.Init (
@@ -317,13 +333,22 @@ TEST(FlagUpdaterEventTests, PatchWithNewFlagProducesEvent) {
317333
318334 std::atomic_bool got_event (false );
319335 notifier->OnFlagChange (
320- " flagB" , [&got_event](std::shared_ptr<FlagValueChangeEvent> event) {
336+ " flagB" ,
337+ [&got_event, &manager](std::shared_ptr<FlagValueChangeEvent> event) {
321338 got_event.store (true );
322339
323340 EXPECT_TRUE (event->OldValue ().IsNull ());
324341 EXPECT_EQ (" second" , event->NewValue ().AsString ());
325342 EXPECT_EQ (" flagB" , event->FlagName ());
326343 EXPECT_FALSE (event->Deleted ());
344+
345+ // The value in the store should be consistent with the new value.
346+ EXPECT_EQ (event->NewValue ().AsString (), manager.Get (" flagB" )
347+ .get ()
348+ ->item .value ()
349+ .Detail ()
350+ .Value ()
351+ .AsString ());
327352 });
328353
329354 updater.Init (
0 commit comments