diff --git a/packages/cli/test/behavior/buy_ship_test.dart b/packages/cli/test/behavior/buy_ship_test.dart index c842d603..92a4fe2e 100644 --- a/packages/cli/test/behavior/buy_ship_test.dart +++ b/packages/cli/test/behavior/buy_ship_test.dart @@ -81,13 +81,10 @@ void main() { final agent = Agent.test(); when(() => caches.agent.agent).thenReturn(agent); registerFallbackValue(agent); - when(() => caches.agent.updateAgent(any())) - .thenAnswer((_) => Future.value()); + when(() => caches.agent.updateAgent(any())).thenAnswer((_) async {}); when(() => caches.waypoints.waypointsInSystem(symbol.system)) - .thenAnswer((_) => Future.value([])); - // when(() => caches.ships.ships).thenReturn([ship]); - // when(() => caches.ships.frameCounts).thenReturn({}); + .thenAnswer((_) async => []); const shipType = ShipType.HEAVY_FREIGHTER; final state = BehaviorState(shipSymbol, Behavior.buyShip) @@ -152,13 +149,12 @@ void main() { ).thenReturn(route); registerFallbackValue(Transaction.fallbackValue()); - when(() => db.insertTransaction(any())).thenAnswer((_) => Future.value()); + when(() => db.insertTransaction(any())).thenAnswer((_) async {}); registerFallbackValue(ShipyardListing.fallbackValue()); - when(() => db.upsertShipyardListing(any())) - .thenAnswer((_) => Future.value()); + when(() => db.upsertShipyardListing(any())).thenAnswer((_) async {}); registerFallbackValue(Ship.fallbackValue()); - when(() => db.upsertShip(any())).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(any())).thenAnswer((_) async {}); when(db.allShipyardListings).thenAnswer((_) async => []); when(db.allShips).thenAnswer((_) async => []); registerFallbackValue(ShipyardListingSnapshot([])); diff --git a/packages/cli/test/behavior/miner_test.dart b/packages/cli/test/behavior/miner_test.dart index bb105633..91aa4685 100644 --- a/packages/cli/test/behavior/miner_test.dart +++ b/packages/cli/test/behavior/miner_test.dart @@ -40,7 +40,7 @@ void main() { final marketPrices = _MockMarketPrices(); final symbol = WaypointSymbol.fromString('S-E-A'); when(() => db.recentSurveysAtWaypoint(symbol, count: 100)) - .thenAnswer((_) => Future.value([])); + .thenAnswer((_) async => []); final surveys = await surveysWorthMining( db, marketPrices, @@ -180,9 +180,9 @@ void main() { ), ); when(() => db.recentSurveysAtWaypoint(waypointSymbol, count: 100)) - .thenAnswer((_) => Future.value([])); + .thenAnswer((_) async => []); registerFallbackValue(ExtractionRecord.fallbackValue()); - when(() => db.insertExtraction(any())).thenAnswer((_) => Future.value()); + when(() => db.insertExtraction(any())).thenAnswer((_) async {}); final logger = _MockLogger(); @@ -218,7 +218,7 @@ void main() { remainingSeconds: 0, ), ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); registerFallbackValue(const SystemSymbol.fallbackValue()); when(() => db.marketPricesInSystem(any())).thenAnswer((_) async => []); @@ -483,8 +483,8 @@ void main() { ), ), ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); - when(() => db.upsertShip(hauler)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); + when(() => db.upsertShip(hauler)).thenAnswer((_) async {}); final logger = _MockLogger(); @@ -605,8 +605,7 @@ void main() { final fleetApi = _MockFleetApi(); final agent = Agent.test(); registerFallbackValue(agent); - when(() => caches.agent.updateAgent(any())) - .thenAnswer((_) => Future.value()); + when(() => caches.agent.updateAgent(any())).thenAnswer((_) async {}); final transaction = MarketTransaction( tradeSymbol: tradeSymbol.value, @@ -619,7 +618,7 @@ void main() { timestamp: now, ); registerFallbackValue(Transaction.fallbackValue()); - when(() => db.insertTransaction(any())).thenAnswer((_) => Future.value()); + when(() => db.insertTransaction(any())).thenAnswer((_) async {}); when(() => api.fleet).thenReturn(fleetApi); when( @@ -670,8 +669,9 @@ void main() { when(() => centralCommand.minimumSurveys).thenReturn(10); when(() => centralCommand.surveyPercentileThreshold).thenReturn(0.9); - when(() => db.marketListingForSymbol(waypointSymbol)) - .thenAnswer((_) => Future.value()); + when(() => db.marketListingForSymbol(waypointSymbol)).thenAnswer((_) async { + return null; + }); final state = BehaviorState(shipSymbol, Behavior.miner) ..extractionJob = ExtractionJob( @@ -679,7 +679,7 @@ void main() { marketForGood: const {}, extractionType: ExtractionType.mine, ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); registerFallbackValue(TradeSymbol.ADVANCED_CIRCUITRY); when(() => db.medianMarketPurchasePrice(any())) .thenAnswer((_) async => 100); diff --git a/packages/cli/test/behavior/mount_from_buy_test.dart b/packages/cli/test/behavior/mount_from_buy_test.dart index 80fac0e3..b353c2c3 100644 --- a/packages/cli/test/behavior/mount_from_buy_test.dart +++ b/packages/cli/test/behavior/mount_from_buy_test.dart @@ -46,8 +46,7 @@ void main() { final agent = Agent.test(); when(() => caches.agent.agent).thenReturn(agent); registerFallbackValue(agent); - when(() => caches.agent.updateAgent(any())) - .thenAnswer((_) => Future.value()); + when(() => caches.agent.updateAgent(any())).thenAnswer((_) async {}); final ship = _MockShip(); when(() => ship.fleetRole).thenReturn(FleetRole.command); @@ -142,7 +141,7 @@ void main() { when( () => caches.waypoints.waypointsInSystem(waypointSymbol.system), - ).thenAnswer((_) => Future.value([])); + ).thenAnswer((_) async => []); when(() => centralCommand.templateForShip(ship)).thenReturn( ShipTemplate( @@ -221,7 +220,7 @@ void main() { ), ); registerFallbackValue(Transaction.fallbackValue()); - when(() => db.insertTransaction(any())).thenAnswer((_) => Future.value()); + when(() => db.insertTransaction(any())).thenAnswer((_) async {}); when( () => caches.routePlanner.planRoute( @@ -247,7 +246,7 @@ void main() { mountSymbol: mountSymbolForTradeSymbol(toMount)!, shipyardSymbol: waypointSymbol, ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); registerFallbackValue(TradeSymbol.ADVANCED_CIRCUITRY); when(() => db.medianMarketPurchasePrice(any())) .thenAnswer((_) async => 100); diff --git a/packages/cli/test/behavior/siphoner_test.dart b/packages/cli/test/behavior/siphoner_test.dart index 0ce188c7..12309322 100644 --- a/packages/cli/test/behavior/siphoner_test.dart +++ b/packages/cli/test/behavior/siphoner_test.dart @@ -113,7 +113,7 @@ void main() { ), ); registerFallbackValue(ExtractionRecord.fallbackValue()); - when(() => db.insertExtraction(any())).thenAnswer((_) => Future.value()); + when(() => db.insertExtraction(any())).thenAnswer((_) async {}); final logger = _MockLogger(); @@ -149,7 +149,7 @@ void main() { remainingSeconds: 0, ), ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); final waitUntil = await runWithLogger( logger, diff --git a/packages/cli/test/behavior/surveyor_test.dart b/packages/cli/test/behavior/surveyor_test.dart index 5d72c8cb..e40cef1c 100644 --- a/packages/cli/test/behavior/surveyor_test.dart +++ b/packages/cli/test/behavior/surveyor_test.dart @@ -69,7 +69,7 @@ void main() { when( () => caches.waypoints.waypointsInSystem(waypointSymbol.system), - ).thenAnswer((_) => Future.value([])); + ).thenAnswer((_) async => []); when(() => fleetApi.createSurvey(shipSymbol.symbol)).thenAnswer( (_) => Future.value( @@ -93,7 +93,7 @@ void main() { marketForGood: const {}, extractionType: ExtractionType.mine, ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); final logger = _MockLogger(); final waitUntil = await runWithLogger( diff --git a/packages/cli/test/behavior/trader_test.dart b/packages/cli/test/behavior/trader_test.dart index 163d774d..1bbe1e1f 100644 --- a/packages/cli/test/behavior/trader_test.dart +++ b/packages/cli/test/behavior/trader_test.dart @@ -157,8 +157,7 @@ void main() { final agent = Agent.test(); when(() => caches.agent.agent).thenReturn(agent); registerFallbackValue(agent); - when(() => caches.agent.updateAgent(any())) - .thenAnswer((_) => Future.value()); + when(() => caches.agent.updateAgent(any())).thenAnswer((_) async {}); final state = BehaviorState(shipSymbol, Behavior.trader); @@ -191,14 +190,14 @@ void main() { ), ); registerFallbackValue(Transaction.fallbackValue()); - when(() => db.insertTransaction(any())).thenAnswer((_) => Future.value()); + when(() => db.insertTransaction(any())).thenAnswer((_) async {}); when(db.allBehaviorStates).thenAnswer((_) async => []); registerFallbackValue(BehaviorSnapshot([])); registerFallbackValue(ShipSnapshot([])); when(() => centralCommand.otherTraderSystems(any(), any(), shipSymbol)) .thenReturn([]); when(db.allShips).thenAnswer((_) async => []); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); when(() => caches.marketPrices.prices).thenReturn([]); @@ -371,8 +370,7 @@ void main() { final agent = Agent.test(); when(() => caches.agent.agent).thenReturn(agent); registerFallbackValue(agent); - when(() => caches.agent.updateAgent(any())) - .thenAnswer((_) => Future.value()); + when(() => caches.agent.updateAgent(any())).thenAnswer((_) async {}); final transaction = MarketTransaction( pricePerUnit: 100, @@ -483,8 +481,8 @@ void main() { ), ).thenReturn(routePlan); registerFallbackValue(Transaction.fallbackValue()); - when(() => db.insertTransaction(any())).thenAnswer((_) => Future.value()); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.insertTransaction(any())).thenAnswer((_) async {}); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); registerFallbackValue(TradeSymbol.ADVANCED_CIRCUITRY); when(() => db.medianMarketPurchasePrice(any())) .thenAnswer((_) async => 100); @@ -720,7 +718,7 @@ void main() { ).thenReturn([]); when(db.allBehaviorStates).thenAnswer((_) async => []); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); final logger = _MockLogger(); final waitUntil = await runWithLogger( @@ -931,7 +929,7 @@ void main() { final state = BehaviorState(const ShipSymbol('S', 1), Behavior.trader) ..deal = costedDeal; - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); final logger = _MockLogger(); final result = await runWithLogger( @@ -1226,17 +1224,16 @@ void main() { when(() => caches.agent.agent).thenReturn(agent); registerFallbackValue(agent); - when(() => caches.agent.updateAgent(any())) - .thenAnswer((_) => Future.value()); + when(() => caches.agent.updateAgent(any())).thenAnswer((_) async {}); registerFallbackValue(Transaction.fallbackValue()); - when(() => db.insertTransaction(any())).thenAnswer((_) => Future.value()); + when(() => db.insertTransaction(any())).thenAnswer((_) async {}); registerFallbackValue(Contract.fallbackValue()); when(() => db.upsertContract(any())).thenAnswer((_) async {}); final state = BehaviorState(const ShipSymbol('S', 1), Behavior.trader) ..deal = costedDeal; - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); registerFallbackValue(TradeSymbol.ADVANCED_CIRCUITRY); when(() => db.medianMarketPurchasePrice(any())) .thenAnswer((_) async => 100); @@ -1421,7 +1418,7 @@ void main() { when(() => caches.agent.agent).thenReturn(agent); registerFallbackValue(Transaction.fallbackValue()); - when(() => db.insertTransaction(any())).thenAnswer((_) => Future.value()); + when(() => db.insertTransaction(any())).thenAnswer((_) async {}); when(caches.construction.allRecords).thenAnswer((_) async => []); when( @@ -1430,7 +1427,7 @@ void main() { final state = BehaviorState(const ShipSymbol('S', 1), Behavior.trader) ..deal = costedDeal; - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); registerFallbackValue(TradeSymbol.ADVANCED_CIRCUITRY); when(() => db.medianMarketPurchasePrice(any())) .thenAnswer((_) async => 100); diff --git a/packages/cli/test/nav/navigation_test.dart b/packages/cli/test/nav/navigation_test.dart index f7a3032c..16c12aef 100644 --- a/packages/cli/test/nav/navigation_test.dart +++ b/packages/cli/test/nav/navigation_test.dart @@ -225,7 +225,7 @@ void main() { registerFallbackValue(Transaction.fallbackValue()); when(() => db.insertTransaction(any())).thenAnswer((_) async {}); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); when(() => centralCommand.medianAntimatterPurchasePrice).thenReturn(10000); final singleJumpResult = await runWithLogger( diff --git a/packages/cli/test/net/actions_test.dart b/packages/cli/test/net/actions_test.dart index b800ecbf..9c0fa31a 100644 --- a/packages/cli/test/net/actions_test.dart +++ b/packages/cli/test/net/actions_test.dart @@ -65,7 +65,7 @@ void main() { registerFallbackValue(agent1); when(() => db.upsertAgent(any())).thenAnswer((_) async {}); registerFallbackValue(Ship.fallbackValue()); - when(() => db.upsertShip(any())).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(any())).thenAnswer((_) async {}); final agentCache = AgentCache(agent1, db); final shipyardSymbol = WaypointSymbol.fromString('S-A-Y'); @@ -99,7 +99,7 @@ void main() { ).thenAnswer( (invocation) => Future.value(GetShipNav200Response(data: shipNav)), ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); await setShipFlightMode(db, api, ship, ShipNavFlightMode.CRUISE); verify(() => ship.nav = shipNav).called(1); @@ -125,7 +125,7 @@ void main() { when(() => ship.nav).thenReturn(shipNav); when(() => shipNav.waypointSymbol).thenReturn('S-A-W'); when(() => shipNav.status).thenReturn(ShipNavStatus.IN_ORBIT); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); final logger = _MockLogger(); await runWithLogger(logger, () => undockIfNeeded(db, api, ship)); @@ -156,7 +156,7 @@ void main() { when(() => ship.nav).thenReturn(shipNav); when(() => shipNav.waypointSymbol).thenReturn('S-A-W'); when(() => shipNav.status).thenReturn(ShipNavStatus.DOCKED); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); final logger = _MockLogger(); await runWithLogger(logger, () => dockIfNeeded(db, api, ship)); @@ -209,7 +209,7 @@ void main() { ), ), ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); final logger = _MockLogger(); await runWithLogger( @@ -280,8 +280,8 @@ void main() { ), ), ); - when(() => db.upsertShip(fromShip)).thenAnswer((_) => Future.value()); - when(() => db.upsertShip(toShip)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(fromShip)).thenAnswer((_) async {}); + when(() => db.upsertShip(toShip)).thenAnswer((_) async {}); final _ = await runWithLogger( logger, @@ -392,7 +392,7 @@ void main() { ), ]); when(() => ship.fuel).thenReturn(ShipFuel(capacity: 1000, current: 634)); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); await runWithLogger( logger, @@ -649,7 +649,7 @@ void main() { ], ); when(() => ship.cargo).thenReturn(shipCargo); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); final transactions = await runWithLogger(logger, () async { final result = await sellAllCargoAndLog( @@ -711,7 +711,7 @@ void main() { ), ), ); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); await runWithLogger(logger, () async { await jettisonCargoAndLog(db, api, ship, itemOne); @@ -934,7 +934,7 @@ void main() { registerFallbackValue(Transaction.fallbackValue()); when(() => db.insertTransaction(any())).thenAnswer((_) async {}); - when(() => db.upsertShip(ship)).thenAnswer((_) => Future.value()); + when(() => db.upsertShip(ship)).thenAnswer((_) async {}); await runWithLogger(logger, () async { await useJumpGateAndLog(