Skip to content

Commit

Permalink
test: fix mining smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel committed Sep 29, 2023
1 parent 0e76031 commit e9408ae
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions packages/cli/test/behavior/miner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ void main() {
when(() => centralCommand.minimumSurveys).thenReturn(10);
when(() => centralCommand.surveyPercentileThreshold).thenReturn(0.9);

final cooldownAfterMining = Cooldown(
shipSymbol: shipSymbol.symbol,
remainingSeconds: 10,
expiration: now.add(const Duration(seconds: 10)),
totalSeconds: 21,
);
final fleetApi = _MockFleetApi();
when(() => api.fleet).thenReturn(fleetApi);
when(
Expand All @@ -233,12 +239,7 @@ void main() {
(_) => Future.value(
ExtractResources201Response(
data: ExtractResources201ResponseData(
cooldown: Cooldown(
shipSymbol: shipSymbol.symbol,
remainingSeconds: 10,
expiration: now,
totalSeconds: 21,
),
cooldown: cooldownAfterMining,
extraction: Extraction(
shipSymbol: shipSymbol.symbol,
yield_: ExtractionYield(
Expand Down Expand Up @@ -303,15 +304,10 @@ void main() {
getNow: getNow,
),
);
// Does not wait after mining, but does set cooldown.
expect(waitUntil, null);
// Will wait after mining to mine again if cargo is not full.
expect(waitUntil, cooldownAfterMining.expiration);
verify(
() => ship.cooldown = Cooldown(
shipSymbol: shipSymbol.symbol,
remainingSeconds: 10,
expiration: DateTime(2021),
totalSeconds: 21,
),
() => ship.cooldown = cooldownAfterMining,
).called(1);
});

Expand Down

0 comments on commit e9408ae

Please sign in to comment.