Compare commits
No commits in common. "931695b22e2bfb5950c69ef8a96d599bd4e6017e" and "ee9d512c1fcc7b5aac87bd389bde7b91e75053fc" have entirely different histories.
931695b22e
...
ee9d512c1f
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
|
@ -328,15 +328,6 @@ class Dispatcher implements DispatcherContract {
|
|||
_transactionManagerResolver = resolver;
|
||||
}
|
||||
|
||||
// Add these methods for testing purposes
|
||||
void triggerQueueResolver() {
|
||||
_queueResolver();
|
||||
}
|
||||
|
||||
void triggerTransactionManagerResolver() {
|
||||
_transactionManagerResolver();
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, List<Function>> getRawListeners() {
|
||||
return Map.unmodifiable(_listeners);
|
||||
|
|
|
@ -147,57 +147,6 @@ void main() {
|
|||
expect(mockMQClient.queuedMessages['events_queue']!.first.payload,
|
||||
containsPair('event', 'QueueTestEvent'));
|
||||
});
|
||||
|
||||
test('forgetPushed removes only pushed events', () {
|
||||
dispatcher.listen('event_pushed', (_, __) {});
|
||||
dispatcher.listen('normal_event', (_, __) {});
|
||||
|
||||
dispatcher.forgetPushed();
|
||||
|
||||
expect(dispatcher.hasListeners('event_pushed'), isFalse);
|
||||
expect(dispatcher.hasListeners('normal_event'), isTrue);
|
||||
});
|
||||
|
||||
test('setQueueResolver and setTransactionManagerResolver', () {
|
||||
var queueResolverCalled = false;
|
||||
var transactionManagerResolverCalled = false;
|
||||
|
||||
dispatcher.setQueueResolver(() {
|
||||
queueResolverCalled = true;
|
||||
});
|
||||
|
||||
dispatcher.setTransactionManagerResolver(() {
|
||||
transactionManagerResolverCalled = true;
|
||||
});
|
||||
|
||||
// Trigger the resolvers
|
||||
dispatcher.triggerQueueResolver();
|
||||
dispatcher.triggerTransactionManagerResolver();
|
||||
|
||||
expect(queueResolverCalled, isTrue);
|
||||
expect(transactionManagerResolverCalled, isTrue);
|
||||
});
|
||||
|
||||
test('getRawListeners returns unmodifiable map', () {
|
||||
dispatcher.listen('test_event', (_, __) {});
|
||||
var rawListeners = dispatcher.getRawListeners();
|
||||
|
||||
expect(rawListeners, isA<Map<String, List<Function>>>());
|
||||
expect(() => rawListeners['new_event'] = [], throwsUnsupportedError);
|
||||
});
|
||||
|
||||
test('multiple listeners for same event', () async {
|
||||
var callCount1 = 0;
|
||||
var callCount2 = 0;
|
||||
|
||||
dispatcher.listen('multi_event', (_, __) => callCount1++);
|
||||
dispatcher.listen('multi_event', (_, __) => callCount2++);
|
||||
|
||||
await dispatcher.dispatch('multi_event');
|
||||
|
||||
expect(callCount1, equals(1));
|
||||
expect(callCount2, equals(1));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |