Fix multi-currency imports (#94)

This commit is contained in:
hackerESQ
2025-05-02 18:14:06 -05:00
committed by GitHub
parent 17e5d8b665
commit de54b6843d
10 changed files with 80 additions and 62 deletions
Binary file not shown.
-1
View File
@@ -84,7 +84,6 @@ class ImportExportTest extends TestCase
]);
$holding = Holding::create([
'id' => '9cf8a662-7347-49fb-b9de-0cc1430a8d1f',
'portfolio_id' => '9e792bb8-94e7-4ed3-b8cc-43b50d34c337',
'symbol' => 'ACME',
'quantity' => 0,
+4 -10
View File
@@ -133,11 +133,8 @@ class MultiCurrencyTest extends TestCase
$portfolio = Portfolio::factory()->create();
$transaction = Transaction::factory()->buy()->lastYear()->portfolio($portfolio->id)->symbol('ACME')->create();
$expected_num_calls = count(collect(CarbonPeriod::create($transaction->date, now()))->chunk(500));
Frankfurter::expects('setSymbols')
->andReturnSelf()
->times($expected_num_calls);
->andReturnSelf();
Frankfurter::expects('timeSeries')
->andReturn(['rates' => [
now()->subDays(3)->toDateString() => [
@@ -152,8 +149,7 @@ class MultiCurrencyTest extends TestCase
now()->toDateString() => [
'ZZZ' => .01,
],
]])
->times($expected_num_calls);
]]);
CurrencyRate::timeSeriesRates(
'', // use fake currency to force
@@ -252,11 +248,9 @@ class MultiCurrencyTest extends TestCase
});
Frankfurter::expects('setSymbols')
->andReturnSelf()
->times(4);
->andReturnSelf();
Frankfurter::expects('timeSeries')
->andReturn(['rates' => $results])
->times(4);
->andReturn(['rates' => $results]);
CurrencyRate::timeSeriesRates('ZZZ', $start, $end);
}