The net worth chart will respect net worth preferences.

This commit is contained in:
James Cole
2018-08-29 10:57:42 +02:00
parent 10d953f336
commit 59f4ecdaa6
9 changed files with 409 additions and 4 deletions

View File

@@ -113,6 +113,48 @@ class ChartJsGeneratorTest extends TestCase
}
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/
public function testMultiCurrencyPieChart(): void
{
$data = [
'one' => ['amount' => -1,'currency_symbol' => 'a'],
'two' => ['amount' => -2,'currency_symbol' => 'b'],
'three' => ['amount' => -3,'currency_symbol' => 'c'],
];
/** @var ChartJsGenerator $generator */
$generator = new ChartJsGenerator();
$result = $generator->multiCurrencyPieChart($data);
$this->assertEquals('three', $result['labels'][0]);
$this->assertEquals(3.0, $result['datasets'][0]['data'][0]);
}
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/
public function testMultiCurrencyPieChartPositive(): void
{
$data = [
'one' => ['amount' => 1,'currency_symbol' => 'a'],
'two' => ['amount' => 2,'currency_symbol' => 'b'],
'three' => ['amount' => 3,'currency_symbol' => 'c'],
];
/** @var ChartJsGenerator $generator */
$generator = new ChartJsGenerator();
$result = $generator->multiCurrencyPieChart($data);
$this->assertEquals('three', $result['labels'][0]);
$this->assertEquals(3.0, $result['datasets'][0]['data'][0]);
}
/**
* @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
*/