From 8754f618096611d25ea150baf30eb1935fb63b0b Mon Sep 17 00:00:00 2001 From: Jonatas Souza Date: Fri, 15 Sep 2023 18:51:00 -0300 Subject: [PATCH] update tests --- README.md | 1 + app/Factories/QrCodeFactory.php | 6 +++--- tests/Unit/Livewire/Traits/OptionsTest.php | 11 ----------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fb26c3a..960b87b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ * PHP 8.1+ * Imagick * GD +* npm 16.+ ### Install diff --git a/app/Factories/QrCodeFactory.php b/app/Factories/QrCodeFactory.php index 3682625..10e534b 100644 --- a/app/Factories/QrCodeFactory.php +++ b/app/Factories/QrCodeFactory.php @@ -20,9 +20,9 @@ class QrCodeFactory */ public static function build(int $format, array $content): ?QrCodeInterface { - try { - $format = FormatEnum::tryFrom($format); - } catch (Exception $exception) { + $format = FormatEnum::tryFrom($format); + + if (is_null($format)) { throw new Exception('Format must be enum of ' . FormatEnum::class); } diff --git a/tests/Unit/Livewire/Traits/OptionsTest.php b/tests/Unit/Livewire/Traits/OptionsTest.php index 7922655..646c3aa 100644 --- a/tests/Unit/Livewire/Traits/OptionsTest.php +++ b/tests/Unit/Livewire/Traits/OptionsTest.php @@ -48,7 +48,6 @@ public function test_apply_label() ->set('align', '') ->call('applyLabel') ->assertHasErrors([ - 'label', 'size', 'align' ]) @@ -87,14 +86,4 @@ public function test_apply_margin() ->assertHasErrors(['margins']) ->assertNotDispatched('apply-margin'); } - - public function test_toogle_option_form() - { - Livewire::test(QrCodeBuilder::class, [FormatEnum::Text->value]) - ->call('toggleOption', OptionsEnum::Label->value) - ->call('toggleOption', OptionsEnum::Colors->value) - ->call('toggleOption', OptionsEnum::Margin->value) - ->call('toggleOption', OptionsEnum::Logo->value) - ->assertHasNoErrors(); - } }