mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
Added tasks endpoints; Added more test
This commit is contained in:
34
tests/Unit/Service/Import/ImportServiceTest.php
Normal file
34
tests/Unit/Service/Import/ImportServiceTest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Service\Import;
|
||||
|
||||
use App\Models\Organization;
|
||||
use App\Service\Import\ImportService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ImportServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_import_gets_importer_from_provider_runs_importer_and_returns_report(): void
|
||||
{
|
||||
// Arrange
|
||||
$organization = Organization::factory()->create();
|
||||
$data = file_get_contents(storage_path('tests/toggl_time_entries_import_test_1.csv'));
|
||||
|
||||
// Act
|
||||
$importService = app(ImportService::class);
|
||||
$report = $importService->import($organization, 'toggl_time_entries', $data);
|
||||
|
||||
// Assert
|
||||
$this->assertSame(2, $report->timeEntriesCreated);
|
||||
$this->assertSame(2, $report->tagsCreated);
|
||||
$this->assertSame(1, $report->tasksCreated);
|
||||
$this->assertSame(1, $report->usersCreated);
|
||||
$this->assertSame(2, $report->projectsCreated);
|
||||
$this->assertSame(1, $report->clientsCreated);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user