Skip to content

Commit

Permalink
test: improve BehaviorCacheExtensions coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel committed Sep 23, 2023
1 parent 3475ad7 commit f01a08b
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions packages/cli/test/behavior/central_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,49 @@ void main() {
});

test('claimedMounts smoke test', () {
final cache = BehaviorCache({}, fs: MemoryFileSystem.test());
final cache = BehaviorCache(
{
ShipSymbol.fromString('X-A'):
BehaviorState(ShipSymbol.fromString('X-A'), Behavior.explorer),
ShipSymbol.fromString('X-B'):
BehaviorState(ShipSymbol.fromString('X-B'), Behavior.trader),
ShipSymbol.fromString('X-C'):
BehaviorState(ShipSymbol.fromString('X-C'), Behavior.changeMounts)
..mountToAdd = ShipMountSymbolEnum.GAS_SIPHON_I,
ShipSymbol.fromString('X-D'):
BehaviorState(ShipSymbol.fromString('X-D'), Behavior.changeMounts)
..mountToAdd = ShipMountSymbolEnum.GAS_SIPHON_I,
ShipSymbol.fromString('X-E'):
BehaviorState(ShipSymbol.fromString('X-E'), Behavior.changeMounts)
..mountToAdd = ShipMountSymbolEnum.GAS_SIPHON_II,
},
fs: MemoryFileSystem.test(),
);
final claimed = cache.claimedMounts();
expect(claimed, isEmpty);
expect(claimed.length, 3);
expect(claimed, [
ShipMountSymbolEnum.GAS_SIPHON_I,
ShipMountSymbolEnum.GAS_SIPHON_I,
ShipMountSymbolEnum.GAS_SIPHON_II,
]);
});

test('dealsInProgress smoke test', () {
final cache = BehaviorCache({}, fs: MemoryFileSystem.test());
final deal = _MockCostedDeal();
final cache = BehaviorCache(
{
ShipSymbol.fromString('X-A'):
BehaviorState(ShipSymbol.fromString('X-A'), Behavior.explorer),
ShipSymbol.fromString('X-B'):
BehaviorState(ShipSymbol.fromString('X-B'), Behavior.trader),
ShipSymbol.fromString('X-C'):
BehaviorState(ShipSymbol.fromString('X-C'), Behavior.trader)
..deal = deal,
},
fs: MemoryFileSystem.test(),
);
final deals = cache.dealsInProgress();
expect(deals, isEmpty);
expect(deals.length, 1);
expect(deals.first, deal);
});
}

0 comments on commit f01a08b

Please sign in to comment.