eventsRoleAppTest function
The test of the events role that the CLI keeps in its
app_tests/events_role, for the apps with the role, whichever module
provides it, that among accepts, or all of them: once the start-up of
the app ran, every listener of a type gets each event of that type once,
in the order the events were fired; a listener of another type gets none
of them, and no error; an event fired before the stream of on<T>() is
listened to is not in it, even after on<T>() returned the stream; and a
cancelled subscription gets no more events.
The test knows only the role and fires events of its own through
createCommunicationService() of the role. The matrix of the fixtures
runs it too, only in the apps with every module, which run other tests
already.
Implementation
Future<MatrixAppTest> eventsRoleAppTest({
bool Function(MatrixApp app)? among,
}) async =>
MatrixAppTest(
'${await appTestsDirectoryOf('smf_flutter_cli')}/events_role',
appliesTo: (app) =>
app.hook!.presentRoles.contains(eventsRole) &&
(among?.call(app) ?? true),
roles: {eventsRole},
);