mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
48 lines
966 B
PHP
48 lines
966 B
PHP
<?php
|
|
namespace Tests\Feature;
|
|
|
|
use Tests\TestCase;
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Laraspace\User;
|
|
use Laravel\Passport\Passport;
|
|
use SettingsSeeder;
|
|
|
|
class DashboardTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
protected $user;
|
|
|
|
public function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
$this->seed();
|
|
$this->seed(SettingsSeeder::class);
|
|
$user = User::find(1);
|
|
$this->withHeaders([
|
|
'company' => $user->company_id,
|
|
]);
|
|
Passport::actingAs(
|
|
$user,
|
|
['*']
|
|
);
|
|
}
|
|
|
|
/** @test */
|
|
public function testDashboard()
|
|
{
|
|
$response = $this->json('GET', 'api/dashboard');
|
|
|
|
$response->assertOk();
|
|
}
|
|
|
|
/** @test */
|
|
public function testPieChartData()
|
|
{
|
|
$response = $this->json('GET', 'api/dashboard/expense/chart');
|
|
|
|
$response->assertOk();
|
|
}
|
|
}
|