-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e3015b
commit 8f159e8
Showing
1 changed file
with
17 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,20 +103,25 @@ void main() { | |
bStore.set('cModel', cModel); | ||
}); | ||
|
||
test('returns only changed values', () | ||
test('subscriptions get notified', () | ||
{ | ||
final store = InMemoryBackingStore() | ||
..set('name', 'Peter') | ||
..set('email', '[email protected]') | ||
..returnOnlyChangedValues = true; | ||
|
||
final changedEntries = store.iterate().toList(); | ||
expect(changedEntries, hasLength(0)); | ||
|
||
store.set('name', 'Wendy'); | ||
final store = InMemoryBackingStore(); | ||
|
||
final changedEntries2 = store.iterate().toList(); | ||
expect(changedEntries2, hasLength(1)); | ||
String? key; | ||
Object? oldValue; | ||
Object? newValue; | ||
final subscriptionId = store.subscribe((k, a, b) { | ||
key = k; | ||
oldValue = a; | ||
newValue = b; | ||
}); | ||
|
||
store.set('name', 'Peter'); | ||
|
||
expect(key, 'name'); | ||
expect(oldValue, null); | ||
expect(newValue, 'Peter'); | ||
expect(subscriptionId, isNotNull); | ||
}); | ||
}); | ||
} |