diff --git a/packages/types/lib/src/market_price.dart b/packages/types/lib/src/market_price.dart index 00829ae5..c22576f1 100644 --- a/packages/types/lib/src/market_price.dart +++ b/packages/types/lib/src/market_price.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:meta/meta.dart'; import 'package:types/price.dart'; import 'package:types/types.dart'; @@ -112,7 +110,4 @@ class MarketPrice extends PriceBase { /// The symbol of the trade good. TradeSymbol get tradeSymbol => symbol; - - @override - String toString() => jsonEncode(toJson()); } diff --git a/packages/types/test/src/market_price_test.dart b/packages/types/test/src/market_price_test.dart index be80bfa8..be97d206 100644 --- a/packages/types/test/src/market_price_test.dart +++ b/packages/types/test/src/market_price_test.dart @@ -21,4 +21,26 @@ void main() { expect(price2.hashCode, price.hashCode); expect(json2, json); }); + + test('MarketPrice.copyWith', () { + final moonLanding = DateTime.utc(1969, 7, 20, 20, 18, 04); + final price = MarketPrice( + waypointSymbol: WaypointSymbol.fromString('S-A-W'), + symbol: TradeSymbol.FUEL, + supply: SupplyLevel.ABUNDANT, + purchasePrice: 1, + sellPrice: 2, + tradeVolume: 10, + timestamp: moonLanding, + activity: ActivityLevel.WEAK, + ); + // Only sellPrice is currently supported. + final price2 = price.copyWith( + sellPrice: 4, + ); + expect(price2.purchasePrice, 1); + expect(price2.sellPrice, 4); + expect(price2.tradeVolume, 10); + expect(price2.activity, ActivityLevel.WEAK); + }); }