diff --git a/tests/Feature/SponsorAuthWebTest.php b/tests/Feature/SponsorAuthWebTest.php
index 65b3ba6..ab7cc90 100644
--- a/tests/Feature/SponsorAuthWebTest.php
+++ b/tests/Feature/SponsorAuthWebTest.php
@@ -90,14 +90,30 @@ public function test_employer_web_registration_with_emirates_id()
]);
$profile = EmployerProfile::where('phone', '501234567')->first();
- $this->assertNotNull($profile->emirates_id_number);
- $this->assertNotNull($profile->emirates_id_expiry);
+ $this->assertEquals('784-1987-5493842-5', $profile->emirates_id_number);
+ $this->assertEquals('2027-12-11', $profile->emirates_id_expiry);
+ $this->assertEquals('Mohammad Jobaier Mohammad Abul Kalam', $profile->emirates_id_name);
+ $this->assertEquals('1987-04-14', $profile->emirates_id_dob);
+ $this->assertEquals('Bangladesh', $profile->nationality);
+ $this->assertEquals('2025-12-12', $profile->emirates_id_issue_date);
+ $this->assertEquals('Msj International Technical Services L.L.C UAE', $profile->emirates_id_employer);
+ $this->assertEquals('Dubai', $profile->emirates_id_issue_place);
+ $this->assertEquals('Electrician', $profile->emirates_id_occupation);
$this->assertDatabaseHas('sponsors', [
'email' => 'abdullah@example.com',
'mobile' => '501234567',
'emirates_id_file' => null, // File is not stored
'address' => 'Villa 14, Al Safa, Dubai',
+ 'emirates_id' => '784-1987-5493842-5',
+ 'emirates_id_name' => 'Mohammad Jobaier Mohammad Abul Kalam',
+ 'emirates_id_dob' => '1987-04-14',
+ 'nationality' => 'Bangladesh',
+ 'emirates_id_issue_date' => '2025-12-12',
+ 'emirates_id_expiry' => '2027-12-11',
+ 'emirates_id_employer' => 'Msj International Technical Services L.L.C UAE',
+ 'emirates_id_issue_place' => 'Dubai',
+ 'emirates_id_occupation' => 'Electrician',
]);
}
@@ -144,8 +160,8 @@ public function test_employer_web_registration_with_two_sided_emirates_id()
$this->assertTrue(session('employer_emirates_id_uploaded'));
$pendingRegAfterId = session('pending_employer_registration');
- $this->assertEquals('784-1988-5310327-2', $pendingRegAfterId['emirates_id_number']); // Mock fallback value
- $this->assertEquals('2028-04-11', $pendingRegAfterId['emirates_id_expiry']); // Mock fallback value
+ $this->assertEquals('784-1987-5493842-5', $pendingRegAfterId['emirates_id_number']); // Mock fallback value
+ $this->assertEquals('2027-12-11', $pendingRegAfterId['emirates_id_expiry']); // Mock fallback value
// Step 4: Payment Choice
$responseStep4 = $this->post('/employer/register-payment', [
@@ -172,8 +188,15 @@ public function test_employer_web_registration_with_two_sided_emirates_id()
$profile = EmployerProfile::where('phone', '509876543')->first();
$this->assertNotNull($profile);
- $this->assertEquals('784-1988-5310327-2', $profile->emirates_id_number);
- $this->assertEquals('2028-04-11', $profile->emirates_id_expiry);
+ $this->assertEquals('784-1987-5493842-5', $profile->emirates_id_number);
+ $this->assertEquals('2027-12-11', $profile->emirates_id_expiry);
+ $this->assertEquals('Mohammad Jobaier Mohammad Abul Kalam', $profile->emirates_id_name);
+ $this->assertEquals('1987-04-14', $profile->emirates_id_dob);
+ $this->assertEquals('Bangladesh', $profile->nationality);
+ $this->assertEquals('2025-12-12', $profile->emirates_id_issue_date);
+ $this->assertEquals('Msj International Technical Services L.L.C UAE', $profile->emirates_id_employer);
+ $this->assertEquals('Dubai', $profile->emirates_id_issue_place);
+ $this->assertEquals('Electrician', $profile->emirates_id_occupation);
$this->assertEquals('Apartment 402, Al Nahda, Sharjah', $profile->address);
}
}
diff --git a/tests/Feature/WorkerJourneyApiTest.php b/tests/Feature/WorkerJourneyApiTest.php
index f443499..a3c2f5b 100644
--- a/tests/Feature/WorkerJourneyApiTest.php
+++ b/tests/Feature/WorkerJourneyApiTest.php
@@ -536,6 +536,103 @@ public function test_register_passport_and_visa_with_direct_json_payload()
$this->assertEquals('Sponsor Name', $visaDoc->ocr_data['sponsor']);
}
+ /**
+ * Test worker registration with the specific passport fields and ocr_accuracy.
+ */
+ public function test_register_passport_with_full_ocr_fields()
+ {
+ $response = $this->postJson('/api/workers/register', [
+ 'name' => 'Temp Name',
+ 'phone' => '+971507777777',
+ 'salary' => 2000,
+ 'password' => 'secret123',
+ 'language' => 'HI',
+ 'passport' => [
+ 'document_type' => 'P',
+ 'issuing_country' => 'HAS',
+ 'surname' => 'KHALED',
+ 'given_names' => 'KHALED AL',
+ 'passport_number' => 'Y34B67890',
+ 'nationality' => 'RE1',
+ 'date_of_birth' => '1990-05-14',
+ 'date_of_expiry' => '2022-05-07',
+ 'place_of_birth' => 'SHARJAH',
+ 'authority' => 'MINISTRY OF INTERIOR U.S. 21 is ,,,, is',
+ 'sex' => 'M',
+ 'date_of_issue' => '2017-07-05',
+ 'ocr_accuracy' => 98.7,
+ ]
+ ]);
+
+ $response->assertStatus(201);
+ $workerId = $response->json('data.worker.id');
+
+ $this->assertDatabaseHas('worker_documents', [
+ 'worker_id' => $workerId,
+ 'type' => 'passport',
+ 'number' => 'Y34B67890',
+ 'expiry_date' => '2022-05-07',
+ 'issue_date' => '2017-07-05',
+ 'ocr_accuracy' => 98.7,
+ ]);
+
+ $passportDoc = \App\Models\WorkerDocument::where('worker_id', $workerId)->where('type', 'passport')->first();
+ $this->assertNotNull($passportDoc->ocr_data);
+ $this->assertEquals('KHALED AL', $passportDoc->ocr_data['given_names']);
+ $this->assertEquals('KHALED', $passportDoc->ocr_data['surname']);
+ $this->assertEquals('MINISTRY OF INTERIOR U.S. 21 is ,,,, is', $passportDoc->ocr_data['authority']);
+ $this->assertEquals(98.7, $passportDoc->ocr_data['ocr_accuracy']);
+ }
+
+ /**
+ * Test worker registration with the specific visa fields and ocr_accuracy.
+ */
+ public function test_register_visa_with_full_ocr_fields()
+ {
+ $response = $this->postJson('/api/workers/register', [
+ 'name' => 'Temp Name',
+ 'phone' => '+971507777778',
+ 'salary' => 2000,
+ 'password' => 'secret123',
+ 'language' => 'HI',
+ 'visa' => [
+ 'document_type' => 'uae_visa',
+ 'country' => 'United Arab Emirates',
+ 'visa_type' => 'ENTRY PERMIT',
+ 'entry_permit_no' => '77003098 / 2019 / 204',
+ 'issue_date' => '',
+ 'valid_until' => '04-MAR-2019',
+ 'uid_no' => '207404887',
+ 'full_name' => 'Mr.MUHAMMAD NADEEM RASHEED',
+ 'nationality' => 'PAKISTAN',
+ 'place_of_birth' => 'SIALKOT PAK',
+ 'date_of_birth' => '25-JUN-1999',
+ 'passport_no' => 'EN9458281',
+ 'profession' => 'SALES REPRESENTATIVE',
+ 'sponsor_name' => '',
+ 'ocr_accuracy' => 97.4,
+ ]
+ ]);
+
+ $response->assertStatus(201);
+ $workerId = $response->json('data.worker.id');
+
+ $this->assertDatabaseHas('worker_documents', [
+ 'worker_id' => $workerId,
+ 'type' => 'visa',
+ 'number' => '77003098 / 2019 / 204',
+ 'expiry_date' => '2019-03-04',
+ 'ocr_accuracy' => 97.4,
+ ]);
+
+ $visaDoc = \App\Models\WorkerDocument::where('worker_id', $workerId)->where('type', 'visa')->first();
+ $this->assertNotNull($visaDoc->ocr_data);
+ $this->assertEquals('uae_visa', $visaDoc->ocr_data['document_type']);
+ $this->assertEquals('ENTRY PERMIT', $visaDoc->ocr_data['visa_type']);
+ $this->assertEquals('Mr.MUHAMMAD NADEEM RASHEED', $visaDoc->ocr_data['full_name']);
+ $this->assertEquals(97.4, $visaDoc->ocr_data['ocr_accuracy']);
+ }
+
/**
* Test worker passport and visa registration when they are passed as JSON strings.
*/
diff --git a/vite.config.js b/vite.config.js
index 0727c05..69084ca 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -23,7 +23,7 @@ export default defineConfig({
port: 5173,
cors: true,
hmr: {
- host: '192.168.29.193',
+ host: '192.168.0.166',
},
watch: {
ignored: ['**/storage/framework/views/**'],