Compare commits

...

4 commits

Author SHA1 Message Date
Patrick Stewart
931695b22e Add: adding wspace dir as workspace for new packages 2024-10-05 10:53:32 -07:00
Patrick Stewart
ae41dbf55d Refactor: moving package candidates to sandbox all potential forks here 2024-10-05 10:52:58 -07:00
Patrick Stewart
2e4e153b4f Update: completed writing initial unit test all are passing 2024-10-05 10:51:21 -07:00
Patrick Stewart
fadcffdc25 Add: adding new directories to build 2024-10-05 10:50:13 -07:00
286 changed files with 62 additions and 0 deletions

View file

@ -328,6 +328,15 @@ 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);

View file

@ -147,6 +147,57 @@ 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));
});
});
}

View file

@ -3,6 +3,8 @@ repository: https://github.com/protevus/platform
packages:
- core/**
- packages/**
- sandbox/**
- wspace/**
- examples/**
command:

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 135 KiB

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Some files were not shown because too many files have changed in this diff Show more