Fixes for tests

This commit is contained in:
David Bomba 2023-04-13 15:43:50 +10:00
parent abf3afd75f
commit 1f7f7e5789
2 changed files with 25 additions and 0 deletions

View File

@ -16,6 +16,7 @@ use App\Models\Scheduler;
use App\Mail\DownloadReport; use App\Mail\DownloadReport;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject; use App\Jobs\Mail\NinjaMailerObject;
use App\Export\CSV\ProductSalesExport; use App\Export\CSV\ProductSalesExport;
use App\DataMapper\Schedule\EmailStatement; use App\DataMapper\Schedule\EmailStatement;

View File

@ -55,6 +55,29 @@ class SchedulerTest extends TestCase
); );
} }
public function testProductSalesReportGeneration()
{
$data = [
'name' => 'A test product sales scheduler',
'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY,
'next_run' => now()->format('Y-m-d'),
'template' => 'email_product_sales_report',
'parameters' => [
'date_range' => EmailStatement::LAST_MONTH,
'clients' => [],
],
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->postJson('/api/v1/task_schedulers', $data);
$response->assertStatus(200);
}
public function testSchedulerGet3() public function testSchedulerGet3()
{ {
@ -539,6 +562,7 @@ class SchedulerTest extends TestCase
$response->assertStatus(200); $response->assertStatus(200);
} }
public function testDeleteSchedule() public function testDeleteSchedule()
{ {
$data = [ $data = [