Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Modules/Clients/Tests/Feature/ContactsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ public function it_lists_contacts(): void
->test(ListContacts::class);

/* Assert */
$component
->assertSuccessful()
->assertSee('Jane Doe');
$component->assertSuccessful();
$component->assertSeeText($payload['first_name']);

$this->assertDatabaseHas('contacts', $payload);
$this->assertSame(1, Contact::query()->where($payload)->count());
Comment on lines +47 to +51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Test no longer validates listing behavior.

The test name it_lists_contacts implies verification that contacts appear in the rendered list, but the current assertions only check that the page loads (assertSuccessful()) and the record exists in the database. The removal of the UI assertion (per AI summary: assertSee('Jane Doe') was removed) means this test no longer validates that the contact actually appears in the displayed list.

Restore a UI-level assertion to verify the contact appears in the rendered output. As per coding guidelines, tests must validate actual behavior, not just page load success.

Suggested fix: add Livewire table assertion
 /* Assert */
 $component->assertSuccessful();
+$component->assertCanSeeTableRecords([$contact]);

 $this->assertDatabaseHas('contacts', $payload);
 $this->assertSame(1, Contact::query()->where($payload)->count());

Alternatively, if you prefer explicit content checking:

 /* Assert */
 $component->assertSuccessful();
+$component->assertSee('Jane Doe');

 $this->assertDatabaseHas('contacts', $payload);
 $this->assertSame(1, Contact::query()->where($payload)->count());

Note: $contact must be defined in the Act section per the first approach.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$component->assertSuccessful();
$this->assertDatabaseHas('contacts', $payload);
$this->assertSame(1, Contact::query()->where($payload)->count());
/* Assert */
$component->assertSuccessful();
$component->assertSee('Jane Doe');
$this->assertDatabaseHas('contacts', $payload);
$this->assertSame(1, Contact::query()->where($payload)->count());
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Modules/Clients/Tests/Feature/ContactsTest.php` around lines 47 - 50, The
test it_lists_contacts currently only asserts the page loads and the DB contains
the record; restore a UI-level assertion so the rendered list actually shows the
contact. After $component->assertSuccessful(), add an assertion on the Livewire
test component to check the contact's displayed name (e.g. $component->assertSee
or assertSeeText with the payload name like 'Jane Doe' or
assertSeeText($payload['name'])); alternatively, if you switch to creating a
$contact model for the Act step, assert the component sees $contact->name.
Ensure you reference the existing $component variable and the $payload/name used
in the DB assertions.

}
# endregion

Expand Down
2 changes: 0 additions & 2 deletions Modules/Clients/Tests/Feature/CustomersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ public function it_fails_to_create_without_required_registered_at(): void
#[Group('crud')]
public function it_deletes_a_customer(): void
{
$this->markTestIncomplete('foreign key contact');

/* Arrange */
$customer = Relation::factory()->for($this->company)->create([
Expand All @@ -392,7 +391,6 @@ public function it_deletes_a_customer(): void
#[Group('crud')]
public function it_fails_to_delete_customer_when_contact_attached(): void
{
$this->markTestIncomplete();

/* Arrange */
$customer = Relation::factory()->for($this->company)->create([
Expand Down
2 changes: 0 additions & 2 deletions Modules/Core/Tests/Feature/CompaniesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ public function it_lists_companies(): void
#[Group('modals')]
public function it_creates_a_company_trough_a_modal(): void
{
$this->markTestIncomplete('need revisit, slug not generated');
/* arrange */
$payload = [
'search_code' => 'ROCKETCORP',
Expand Down Expand Up @@ -312,7 +311,6 @@ public function it_updates_a_company(): void
*/
public function it_deletes_a_company(): void
{
$this->markTestIncomplete('do not delete companies yet');

/* Arrange */
$company = Company::factory()->create([
Expand Down
2 changes: 0 additions & 2 deletions Modules/Core/Tests/Feature/NumberingPanelAccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public function it_allows_admin_to_assign_numbering_to_any_company(): void
}

#[Test]
#[Group('failing')]
public function it_restricts_company_panel_to_current_company_only(): void
{
/* Arrange */
Expand Down Expand Up @@ -124,7 +123,6 @@ public function it_prevents_company_user_from_changing_company_id(): void

// Attempting to update with different company_id should fail or be ignored
// In practice, this would be prevented by form validation or policy
$this->assertTrue(true); // Placeholder - actual enforcement is in Filament form
}

#[Test]
Expand Down
2 changes: 0 additions & 2 deletions Modules/Core/Tests/Feature/NumberingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public function it_creates_a_numbering_scheme(): void

#[Test]
#[Group('crud')]
#[Group('failing')]
public function it_updates_a_numbering_scheme(): void
{
/* Arrange */
Expand Down Expand Up @@ -141,7 +140,6 @@ public function it_updates_a_numbering_scheme(): void

#[Test]
#[Group('crud')]
#[Group('failing')]
public function it_deletes_a_numbering_scheme(): void
{
/* Arrange */
Expand Down
9 changes: 0 additions & 9 deletions Modules/Core/Tests/Feature/ReportBuilderBlockEditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function it_looks_up_block_by_block_type(): void
$this->assertNotNull($foundBlock);
$this->assertEquals('company_header', $foundBlock->block_type);
$this->assertEquals('Company Header', $foundBlock->name);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -86,7 +85,6 @@ public function it_populates_form_with_block_data(): void
$this->assertEquals('details', $data['default_band']);
$this->assertTrue($data['is_active']);
$this->assertIsArray($data['config']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -110,7 +108,6 @@ public function it_converts_width_enum_to_value_for_form(): void

/* Assert */
$this->assertEquals('two_thirds', $data['width']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -136,7 +133,6 @@ public function it_provides_default_values_when_block_not_found(): void
$this->assertNull($block);
$this->assertEquals($blockType, $defaultData['block_type']);
$this->assertTrue($defaultData['is_active']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -165,8 +161,6 @@ public function it_logs_block_data_for_debugging(): void
Log::info('Mounting block config with data:', $data);

/* Assert */
$this->assertTrue(true); // Log assertions are handled by shouldReceive
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -206,7 +200,6 @@ public function it_handles_all_block_types_correctly(): void
$this->assertInstanceOf(ReportBlock::class, $block);
$this->assertContains($block->block_type, $blockTypes);
}
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -234,7 +227,6 @@ public function it_preserves_config_array_when_editing(): void
$this->assertEquals($config, $data['config']);
$this->assertTrue($data['config']['show_vat_id']);
$this->assertEquals(10, $data['config']['font_size']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -257,6 +249,5 @@ public function it_uses_slug_for_lookup_when_available(): void
$this->assertNotNull($foundByType);
$this->assertEquals($foundBySlug->id, $foundByType->id);
$this->assertEquals('slug_lookup_test', $foundBySlug->block_type);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}
}
8 changes: 0 additions & 8 deletions Modules/Core/Tests/Feature/ReportBuilderBlockWidthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public function it_renders_one_third_width_block_with_correct_grid_span(): void
/* Assert */
$this->assertEquals(4, $gridWidth);
$this->assertEquals(ReportBlockWidth::ONE_THIRD, $block->width);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -69,7 +68,6 @@ public function it_renders_half_width_block_with_correct_grid_span(): void
/* Assert */
$this->assertEquals(6, $gridWidth);
$this->assertEquals(ReportBlockWidth::HALF, $block->width);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -89,7 +87,6 @@ public function it_renders_two_thirds_width_block_with_correct_grid_span(): void
/* Assert */
$this->assertEquals(8, $gridWidth);
$this->assertEquals(ReportBlockWidth::TWO_THIRDS, $block->width);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -109,7 +106,6 @@ public function it_renders_full_width_block_with_correct_grid_span(): void
/* Assert */
$this->assertEquals(12, $gridWidth);
$this->assertEquals(ReportBlockWidth::FULL, $block->width);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -141,7 +137,6 @@ public function it_correctly_maps_block_widths_to_grid_columns_in_template(): vo

/* Assert */
$this->assertEquals([4, 6, 8, 12], $mappedWidths);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -161,7 +156,6 @@ public function it_handles_invoice_items_block_as_full_width(): void
/* Assert */
$this->assertEquals(12, $gridWidth);
$this->assertEquals(ReportBlockWidth::FULL, $block->width);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -189,7 +183,6 @@ public function it_applies_correct_css_grid_column_span_for_block_widths(): void
"Width {$testCase['width']->value} (grid: {$gridWidth}) should span {$testCase['expectedSpan']} columns"
);
}
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -216,6 +209,5 @@ public function it_ensures_blocks_maintain_width_after_being_added_to_band(): vo
$this->assertEquals($initialWidth, $finalWidth);
$this->assertEquals($initialGridWidth, $finalGridWidth);
$this->assertEquals(8, $finalGridWidth);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public function it_saves_fields_when_configuring_block(): void
$this->assertCount(2, $loadedFields);
$this->assertEquals('company_name', $loadedFields[0]['id']);
Storage::disk('local')->assertExists('report_blocks/test-canvas.json');
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -103,7 +102,6 @@ public function it_separates_fields_from_block_data_when_saving(): void
$this->assertEquals('full', $block->width->value);
$loadedFields = $this->service->loadBlockFields($block);
$this->assertCount(1, $loadedFields);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -129,7 +127,6 @@ public function it_handles_empty_fields_array_gracefully(): void
$this->assertIsArray($loadedFields);
$this->assertEmpty($loadedFields);
Storage::disk('local')->assertExists('report_blocks/empty-fields.json');
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -174,7 +171,6 @@ public function it_preserves_field_positions_and_dimensions(): void
$this->assertEquals(200, $loadedFields[0]['width']);
$this->assertEquals(40, $loadedFields[0]['height']);
$this->assertEquals(220, $loadedFields[1]['x']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -203,7 +199,6 @@ public function it_loads_existing_fields_when_opening_block_editor(): void
/* Assert */
$this->assertCount(2, $loadedFields);
$this->assertEquals($initialFields, $loadedFields);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -239,7 +234,6 @@ public function it_allows_updating_fields_through_multiple_edits(): void
$this->assertCount(1, $afterFirst);
$this->assertCount(2, $afterSecond);
$this->assertEquals('field2', $afterSecond[1]['id']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -283,7 +277,6 @@ public function it_handles_complex_field_metadata(): void
$this->assertEquals('#ff0000', $loadedFields[0]['style']['color']);
$this->assertEquals(14, $loadedFields[0]['style']['fontSize']);
$this->assertTrue($loadedFields[0]['visible']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -320,6 +313,5 @@ public function it_works_with_all_block_width_types(): void
$this->assertCount(1, $loadedFields);
$this->assertEquals('test_field', $loadedFields[0]['id']);
}
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}
}
12 changes: 0 additions & 12 deletions Modules/Core/Tests/Unit/DateFieldAutoPopulationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,8 @@ public function it_auto_populates_payment_date_fields_on_create_form(): void
#[Test]
#[Group('date-auto-population')]
#[Group('edge-cases')]
#[Group('failing')]
public function it_handles_timezone_differences_correctly(): void
{
$this->markTestIncomplete('no assertions?');

/* Arrange */
$originalTimezone = config('app.timezone');
Expand Down Expand Up @@ -186,10 +184,8 @@ public function it_handles_timezone_differences_correctly(): void
#[Test]
#[Group('date-auto-population')]
#[Group('edge-cases')]
#[Group('failing')]
public function it_handles_multiple_date_fields_consistently(): void
{
$this->markTestIncomplete('no assertions?');

/* Arrange */
$customer = $this->createTestCustomer();
Expand Down Expand Up @@ -228,10 +224,8 @@ public function it_handles_multiple_date_fields_consistently(): void
#[Test]
#[Group('date-auto-population')]
#[Group('edge-cases')]
#[Group('failing')]
public function it_handles_date_field_auto_population_during_high_load(): void
{
$this->markTestIncomplete('no assertions?');

/* Arrange */
$customer = $this->createTestCustomer();
Expand Down Expand Up @@ -264,10 +258,8 @@ public function it_handles_date_field_auto_population_during_high_load(): void
#[Test]
#[Group('date-auto-population')]
#[Group('edge-cases')]
#[Group('failing')]
public function it_maintains_date_precision_across_different_formats(): void
{
$this->markTestIncomplete('no assertions?');

/* Arrange */
$customer = $this->createTestCustomer();
Expand Down Expand Up @@ -305,10 +297,8 @@ public function it_maintains_date_precision_across_different_formats(): void
#[Test]
#[Group('date-auto-population')]
#[Group('edge-cases')]
#[Group('failing')]
public function it_handles_date_auto_population_with_invalid_session_data(): void
{
$this->markTestIncomplete('no assertions?');

/* Arrange */
$customer = $this->createTestCustomer();
Expand Down Expand Up @@ -338,10 +328,8 @@ public function it_handles_date_auto_population_with_invalid_session_data(): voi

#[Test]
#[Group('date-auto-population')]
#[Group('failing')]
public function it_filters_numberings_by_current_company_id(): void
{
$this->markTestIncomplete('still failing');

/* Arrange */
// Clean up any default numberings created by CompanyObserver during setup
Expand Down
8 changes: 0 additions & 8 deletions Modules/Core/Tests/Unit/ReportBlockServiceFieldsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public function it_saves_block_fields_to_json_file(): void
$this->assertArrayHasKey('fields', $config);
$this->assertCount(2, $config['fields']);
$this->assertEquals('company_name', $config['fields'][0]['id']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -86,7 +85,6 @@ public function it_loads_block_fields_from_json_file(): void
$this->assertEquals('invoice_number', $loadedFields[0]['id']);
$this->assertEquals('invoice_date', $loadedFields[1]['id']);
$this->assertEquals(100, $loadedFields[0]['x']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -108,7 +106,6 @@ public function it_returns_empty_array_when_json_file_does_not_exist(): void
/* Assert */
$this->assertIsArray($fields);
$this->assertEmpty($fields);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -134,7 +131,6 @@ public function it_creates_directory_if_not_exists_when_saving(): void
/* Assert */
Storage::disk('local')->assertExists('report_blocks');
Storage::disk('local')->assertExists('report_blocks/new-block.json');
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -164,7 +160,6 @@ public function it_gets_full_block_configuration_from_json(): void
$this->assertIsArray($config);
$this->assertArrayHasKey('fields', $config);
$this->assertCount(2, $config['fields']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand All @@ -189,7 +184,6 @@ public function it_uses_slug_as_filename_when_filename_is_null(): void

/* Assert */
Storage::disk('local')->assertExists('report_blocks/slug-block.json');
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -222,7 +216,6 @@ public function it_overwrites_existing_fields_when_saving(): void
/* Assert */
$this->assertCount(1, $loadedFields);
$this->assertEquals('field3', $loadedFields[0]['id']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}

#[Test]
Expand Down Expand Up @@ -258,6 +251,5 @@ public function it_preserves_json_structure_when_saving_and_loading(): void
$this->assertEquals($fields, $loadedFields);
$this->assertArrayHasKey('style', $loadedFields[0]);
$this->assertEquals('red', $loadedFields[0]['style']['color']);
$this->markTestIncomplete('Test implementation complete but marked incomplete as per requirements');
}
}
Loading