Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel committed Feb 24, 2024
1 parent 3f72f4a commit 808a9bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
3 changes: 3 additions & 0 deletions packages/cli/test/behavior/miner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ void main() {
when(() => centralCommand.minimumSurveys).thenReturn(10);
when(() => centralCommand.surveyPercentileThreshold).thenReturn(0.9);

when(() => db.marketListingForSymbol(waypointSymbol))
.thenAnswer((_) => Future.value());

final state = BehaviorState(shipSymbol, Behavior.miner)
..extractionJob = ExtractionJob(
source: waypointSymbol,
Expand Down
49 changes: 22 additions & 27 deletions packages/cli/test/extraction_score_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,24 @@ void main() {
TradeSymbol.SILICON_CRYSTALS,
TradeSymbol.QUARTZ_SAND,
};
when(() => marketListings[marketA.symbol]).thenReturn(
MarketListing(
waypointSymbol: marketA.symbol,
imports: const {
TradeSymbol.IRON_ORE,
TradeSymbol.COPPER_ORE,
TradeSymbol.ALUMINUM_ORE,
},
),
);
when(() => marketListings[marketB.symbol]).thenReturn(
MarketListing(
waypointSymbol: marketB.symbol,
imports: const {
TradeSymbol.ICE_WATER,
TradeSymbol.SILICON_CRYSTALS,
TradeSymbol.QUARTZ_SAND,
},
),
);
const aImports = {
TradeSymbol.IRON_ORE,
TradeSymbol.COPPER_ORE,
TradeSymbol.ALUMINUM_ORE,
};
for (final good in aImports) {
when(() => db.marketsWithImportInSystem(systemSymbol, good))
.thenAnswer((_) async => [marketA.symbol]);
}
const bImports = {
TradeSymbol.ICE_WATER,
TradeSymbol.SILICON_CRYSTALS,
TradeSymbol.QUARTZ_SAND,
};
for (final good in bImports) {
when(() => db.marketsWithImportInSystem(systemSymbol, good))
.thenAnswer((_) async => [marketB.symbol]);
}
when(() => chartingCache.chartedValues(sourceSymbol)).thenAnswer(
(_) async => ChartedValues.test(
traitSymbols: const {
Expand Down Expand Up @@ -100,7 +98,6 @@ void main() {
final db = _MockDatabase();
final systemsCache = _MockSystemsCache();
final chartingCache = _MockChartingCache();
final marketListings = _MockMarketListingSnapshot();
final sourceSymbol = WaypointSymbol.fromString('W-A-A');
final systemSymbol = SystemSymbol.fromString('W-A');
final source = SystemWaypoint.test(
Expand All @@ -123,12 +120,10 @@ void main() {
TradeSymbol.LIQUID_HYDROGEN,
TradeSymbol.LIQUID_NITROGEN,
};
when(() => marketListings[market.symbol]).thenReturn(
MarketListing(
waypointSymbol: market.symbol,
imports: producedGoods,
),
);
for (final good in producedGoods) {
when(() => db.marketsWithImportInSystem(systemSymbol, good))
.thenAnswer((_) async => [market.symbol]);
}
when(() => chartingCache.chartedValues(sourceSymbol)).thenAnswer(
(_) async => ChartedValues.test(),
);
Expand Down

0 comments on commit 808a9bc

Please sign in to comment.