mergedMocksFor static method
Implementation
static Future<TestMocks> mergedMocksFor({
required String assetPath,
List<String> suiteMockFiles = const [],
Map<String, dynamic> suiteInlineMocks = const {},
required List<String> mockFiles,
required Map<String, dynamic> inlineMocks,
required AssetStringLoader assetLoader,
}) async {
final raw = <String, Map<String, dynamic>>{};
for (final file in suiteMockFiles) {
await _mergeMockFile(
into: raw,
fromAssetPath: assetPath,
mockFilePath: file,
assetLoader: assetLoader,
);
}
await _mergeInlineMocks(
into: raw,
inlineMocks: suiteInlineMocks,
sourceLabel: 'tests/config.yaml',
fromAssetPath: assetPath,
assetLoader: assetLoader,
);
for (final file in mockFiles) {
await _mergeMockFile(
into: raw,
fromAssetPath: assetPath,
mockFilePath: file,
assetLoader: assetLoader,
);
}
await _mergeInlineMocks(
into: raw,
inlineMocks: inlineMocks,
sourceLabel: assetPath,
fromAssetPath: assetPath,
assetLoader: assetLoader,
);
return TestMocks(
apis: MockComposition.toMockApis(raw, sourceLabel: assetPath),
);
}