Expand allowlist for assets in test

This commit is contained in:
Simon Binder 2024-04-23 15:04:22 +02:00
parent b94516acc7
commit ccae3b4ee6
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 6 additions and 3 deletions

View File

@ -578,13 +578,15 @@ class MyDatabase {
}; };
final outputs = await emulateDriftBuild(inputs: inputs); final outputs = await emulateDriftBuild(inputs: inputs);
final readAssets = outputs.readAssetsByBuilder; final readAssets = outputs.readAssetsByBuilder;
// Allow reading SDK or other package assets to set up the analyzer.
final isFromExternalPackage =
isA<AssetId>().having((e) => e.package, 'package', isNot('a'));
Matcher onlyReadsJsonsAnd(dynamic other) { Matcher onlyReadsJsonsAnd(dynamic other) {
return everyElement( return everyElement(
anyOf( anyOf(
isA<AssetId>().having((e) => e.extension, 'extension', '.json'), isA<AssetId>().having((e) => e.extension, 'extension', '.json'),
// Allow reading SDK or other package assets to set up the analyzer. isFromExternalPackage,
isA<AssetId>().having((e) => e.package, 'package', isNot('a')),
other, other,
), ),
); );
@ -608,7 +610,8 @@ class MyDatabase {
// However, the discover builder should not read other drift files. // However, the discover builder should not read other drift files.
for (final input in inputs.keys) { for (final input in inputs.keys) {
if (input.endsWith('.drift')) { if (input.endsWith('.drift')) {
expectReadsForBuilder(input, DriftDiscover, [makeAssetId(input)]); expectReadsForBuilder(input, DriftDiscover,
everyElement(anyOf(makeAssetId(input), isFromExternalPackage)));
} else { } else {
expectReadsForBuilder( expectReadsForBuilder(
input, input,