envRoleAppTest function
The test of the env role that the CLI keeps in its app_tests/env_role,
for the apps with the role that have keys, whichever module provides the
role, that among accepts, or all of them: for each key of
the app, the getter of AppEnv returns the value that .env gives the
key, and null when .env leaves the value empty or lacks the key.
The test only reads: it parses the file of the values of the app
(EnvRole.dotEnvFile), in the forms of a value that the role names, as
the matrix wrote it with the values that the tests of the modules of the
app give their keys (MatrixAppTest.envValues), and it gives no value
itself. The matrix writes the keys of the app for it into envKeysFile,
from the data of the role. It has no probe for the start check: the
values of an app on a device are those of its developer.
Only the apps of the fixtures have a key that .env lacks, whose line
the test of a fixture module removes. In an app of the CLI, the template
of the role writes a line for every key and no test of a module removes
one, so the test of the missing keys is skipped there, and only the
fixture provider of the role is checked for them.
Implementation
Future<MatrixAppTest> envRoleAppTest({
bool Function(MatrixApp app)? among,
}) async =>
MatrixAppTest(
'${await appTestsDirectoryOf('smf_flutter_cli')}/env_role',
appliesTo: (app) =>
_envKeysOf(app).isNotEmpty && (among?.call(app) ?? true),
generatedFiles: _envKeysFileOf,
roles: {envRole},
);