Add test case for saving custom reports

This commit is contained in:
Marcus Moore 2023-12-11 16:25:36 -08:00
parent 89c47c1879
commit c68a2a36fa
No known key found for this signature in database

View file

@ -38,7 +38,23 @@ class SavedReportsTest extends TestCase
public function testCanSaveACustomReport()
{
$this->markTestIncomplete();
$user = User::factory()->canViewReports()->create();
$this->actingAs($user)
->post(route('savedreports/store'), [
'name' => 'My Awesome Report',
'company' => '1',
'by_company_id' => ['1', '2'],
])
->assertRedirect();
$report = $user->savedReports->first(function ($report) {
return $report->name === 'My Awesome Report';
});
$this->assertNotNull($report);
$this->assertEquals('1', $report->options['company']);
$this->assertEquals(['1', '2'], $report->options['by_company_id']);
}
public function testSavingReportRequiresValidFields()