#134 - tests
This commit is contained in:
		| @@ -69,8 +69,8 @@ class ResumeGenerator | ||||
|     { | ||||
|         return [ | ||||
|             "index#{$index}" => $index, | ||||
|             "start_date#{$index}" => Carbon::create($project["startDate"])->toDisplayString(), | ||||
|             "end_date#{$index}" => $project["current"] ? "present" : Carbon::create($project["endDate"])->format("m.Y"), | ||||
|             "start_date#{$index}" => Carbon::createFromFormat("m/Y", $project["startDate"])->format("n.Y"), | ||||
|             "end_date#{$index}" => $project["current"] ? "present" : Carbon::createFromFormat("m/Y", $project["endDate"])->format("n.Y"), | ||||
|             "description#{$index}" => $project["description"], | ||||
|             "tasks#{$index}" => $this->withNewLines($project["tasks"]), | ||||
|         ]; | ||||
| @@ -109,8 +109,8 @@ class ResumeGenerator | ||||
|     protected function getEducation(Resume $resume): array | ||||
|     { | ||||
|         return $resume->education->map(fn(array $project, int $index): array => [ | ||||
|             "start_date" => Carbon::create($project["startDate"])->toDisplayString(), | ||||
|             "end_date" => $project["current"] ? "present" : Carbon::create($project["endDate"])->format("m.Y"), | ||||
|             "start_date" => Carbon::createFromFormat("m/Y", $project["startDate"])->format("n.Y"), | ||||
|             "end_date" => $project["current"] ? "present" : Carbon::createFromFormat("m/Y", $project["endDate"])->format("n.Y"), | ||||
|             "school" => $project["school"], | ||||
|             "field_of_study" => $project["fieldOfStudy"], | ||||
|             "degree" => $project["degree"], | ||||
|   | ||||
| @@ -9,17 +9,15 @@ use Illuminate\Support\Carbon; | ||||
| use Inertia\Testing\AssertableInertia as Assert; | ||||
| use Tests\FeatureTestCase; | ||||
| use Toby\Domain\Enums\EmploymentForm; | ||||
| use Toby\Eloquent\Models\Holiday; | ||||
| use Toby\Eloquent\Models\Resume; | ||||
| use Toby\Eloquent\Models\Technology; | ||||
| use Toby\Eloquent\Models\User; | ||||
| use Toby\Eloquent\Models\YearPeriod; | ||||
|  | ||||
| class ResumeTest extends FeatureTestCase | ||||
| { | ||||
|     use DatabaseMigrations; | ||||
|  | ||||
|     public function setUp(): void | ||||
|     protected function setUp(): void | ||||
|     { | ||||
|         parent::setUp(); | ||||
|  | ||||
| @@ -125,6 +123,18 @@ class ResumeTest extends FeatureTestCase | ||||
|         ]); | ||||
|     } | ||||
|  | ||||
|     public function testAdminCanGenerateResume(): void | ||||
|     { | ||||
|         $resume = Resume::factory()->create(); | ||||
|         $admin = User::factory()->admin()->create(); | ||||
|  | ||||
|         $this->withoutExceptionHandling(); | ||||
|  | ||||
|         $this->actingAs($admin) | ||||
|             ->get("/resumes/{$resume->id}") | ||||
|             ->assertDownload("resume-{$resume->id}.docx"); | ||||
|     } | ||||
|  | ||||
|     public function testAdminCanDeleteResume(): void | ||||
|     { | ||||
|         $resume = Resume::factory()->create(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user