feat(brand): update footer color mapping and adjust tests

This commit is contained in:
2026-09-29 14:28:53 -03:00
parent 4bdd3effcc
commit a9d9854e5e
2 changed files with 46 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ class AdminAppBrandControllerTest extends TestCase
'nombre' => 'Acme',
'primary_color' => '#112233',
'header_bg_color' => '#223344',
'footer_bg_color' => '#445566',
'footer_bg_color' => '#112233',
'header_logo_id' => $header->id,
'footer_logo_id' => $footer->id,
]);
@@ -75,7 +75,7 @@ class AdminAppBrandControllerTest extends TestCase
->assertJsonPath('data.nombre', 'Acme')
->assertJsonPath('data.primary_color', '#112233')
->assertJsonPath('data.header_bg_color', '#223344')
->assertJsonPath('data.footer_bg_color', '#445566')
->assertJsonPath('data.footer_color', 'primary')
->assertJsonCount(2, 'data.banner_images');
foreach (['header_logo' => $header, 'footer_logo' => $footer] as $field => $image) {
@@ -94,6 +94,29 @@ class AdminAppBrandControllerTest extends TestCase
$this->assertStringNotContainsString('other.png', $response->getContent());
}
public function test_footer_color_is_mapped_to_a_supported_option(): void
{
$websiteType = $this->websiteType('shopit');
$cases = [
['primary', '#112233', '#112233'],
['white', '#112233', '#FFFFFF'],
['black', '#112233', '#000000'],
['primary', '#112233', '#445566'],
];
foreach ($cases as $index => [$expected, $primaryColor, $footerColor]) {
$tenant = $this->tenant("tenant-{$index}", $websiteType, [
'primary_color' => $primaryColor,
'footer_bg_color' => $footerColor,
]);
Sanctum::actingAs($this->admin($tenant));
$this->getJson('/api/v1/adminapp/tenant/brand')
->assertOk()
->assertJsonPath('data.footer_color', $expected);
}
}
public function test_missing_and_non_shopit_carousels_return_an_empty_list(): void
{
$shopit = $this->websiteType('shopit');