From baaf9e50a01b570bdf7899db1fc1ed372d0ab044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Drunen?= Date: Tue, 26 Dec 2023 23:22:02 +0100 Subject: [PATCH] Test jobs responsible for fetching conversion rates --- tests/Unit/Jobs/FetchConversionRatesTest.php | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/Unit/Jobs/FetchConversionRatesTest.php diff --git a/tests/Unit/Jobs/FetchConversionRatesTest.php b/tests/Unit/Jobs/FetchConversionRatesTest.php new file mode 100644 index 00000000..946e6823 --- /dev/null +++ b/tests/Unit/Jobs/FetchConversionRatesTest.php @@ -0,0 +1,48 @@ +call([new FetchConversionRates(), 'handle']); + + Queue::assertPushed(FetchConversionRate::class, 0); + + Currency::factory() + ->create([ + 'name' => 'US Dollar', + 'symbol' => '$', + 'iso' => 'USD', + ]); + + Currency::factory() + ->create([ + 'name' => 'Euro', + 'symbol' => '&eur;', + 'iso' => 'EUR', + ]); + + Currency::factory() + ->create([ + 'name' => 'British Pound', + 'symbol' => '£', + 'iso' => 'GBP', + ]); + + app()->call([new FetchConversionRates(), 'handle']); + + Queue::assertPushed(FetchConversionRate::class, 3); + } +}