From d60accbd60c0ceb78dcc68122a45accda3b0209c Mon Sep 17 00:00:00 2001
From: Arthur Pariente <arthur.pariente78960@gmail.com>
Date: Thu, 28 Mar 2024 15:32:18 +0100
Subject: [PATCH] Update testFareImporter

---
 tests/ImporterTest.php | 15 ++++++++++++++-
 tests/data/fares.csv   |  9 +++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/tests/ImporterTest.php b/tests/ImporterTest.php
index f0af5c3bd..c48150b9b 100644
--- a/tests/ImporterTest.php
+++ b/tests/ImporterTest.php
@@ -9,6 +9,7 @@
 use App\Models\Enums\AircraftStatus;
 use App\Models\Enums\Days;
 use App\Models\Enums\ExpenseType;
+use App\Models\Enums\FareType;
 use App\Models\Enums\FlightType;
 use App\Models\Expense;
 use App\Models\Fare;
@@ -461,13 +462,14 @@ public function testFareImporter(): void
         $file_path = base_path('tests/data/fares.csv');
         $status = $this->importSvc->importFares($file_path);
 
-        $this->assertCount(3, $status['success']);
+        $this->assertCount(4, $status['success']);
         $this->assertCount(0, $status['errors']);
 
         $fares = Fare::all();
 
         $y_class = $fares->firstWhere('code', 'Y');
         $this->assertEquals('Economy', $y_class->name);
+        $this->assertEquals(FareType::PASSENGER, $y_class->type);
         $this->assertEquals(100, $y_class->price);
         $this->assertEquals(0, $y_class->cost);
         $this->assertEquals(200, $y_class->capacity);
@@ -476,6 +478,7 @@ public function testFareImporter(): void
 
         $b_class = $fares->firstWhere('code', 'B');
         $this->assertEquals('Business', $b_class->name);
+        $this->assertEquals(FareType::PASSENGER, $b_class->type);
         $this->assertEquals(500, $b_class->price);
         $this->assertEquals(250, $b_class->cost);
         $this->assertEquals(10, $b_class->capacity);
@@ -484,11 +487,21 @@ public function testFareImporter(): void
 
         $f_class = $fares->firstWhere('code', 'F');
         $this->assertEquals('First-Class', $f_class->name);
+        $this->assertEquals(FareType::PASSENGER, $f_class->type);
         $this->assertEquals(800, $f_class->price);
         $this->assertEquals(350, $f_class->cost);
         $this->assertEquals(5, $f_class->capacity);
         $this->assertEquals('', $f_class->notes);
         $this->assertTrue($f_class->active);
+
+        $cargo = $fares->firstWhere('code', 'C');
+        $this->assertEquals('Cargo', $cargo->name);
+        $this->assertEquals(FareType::CARGO, $cargo->type);
+        $this->assertEquals(20, $cargo->price);
+        $this->assertEquals(0, $cargo->cost);
+        $this->assertEquals(10, $cargo->capacity);
+        $this->assertEquals('', $cargo->notes);
+        $this->assertTrue($cargo->active);
     }
 
     /**
diff --git a/tests/data/fares.csv b/tests/data/fares.csv
index 391a9dbb1..80f24f38f 100644
--- a/tests/data/fares.csv
+++ b/tests/data/fares.csv
@@ -1,4 +1,5 @@
-code,name,price,cost,capacity,notes,active
-Y,Economy,100,0,200,This is the economy class,1
-B,Business,500,250,10,"This is business class",0
-F,First-Class,800,350,5,,1
+code,name,type,price,cost,capacity,notes,active
+Y,Economy,0,100,0,200,This is the economy class,1
+B,Business,0,500,250,10,"This is business class",0
+F,First-Class,0,800,350,5,,1
+C,Cargo,1,20,0,10,,1