From 6143040465a8e503f9fafa90c1a9843b33ecea84 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/FetchConversionRateTest.php | 35 ++++++++++++++++++++ tests/Unit/Jobs/FetchConversionRatesTest.php | 22 ++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/Unit/Jobs/FetchConversionRateTest.php create mode 100644 tests/Unit/Jobs/FetchConversionRatesTest.php diff --git a/tests/Unit/Jobs/FetchConversionRateTest.php b/tests/Unit/Jobs/FetchConversionRateTest.php new file mode 100644 index 00000000..8801e41e --- /dev/null +++ b/tests/Unit/Jobs/FetchConversionRateTest.php @@ -0,0 +1,35 @@ +assertDatabaseEmpty(ConversionRate::class); + + app()->call([new FetchConversionRate(1), 'handle']); + + $this->assertDatabaseHas( + ConversionRate::class, + [ + 'base_currency_id' => 1, + 'target_currency_id' => 2, + ], + ); + + $this->assertDatabaseHas( + ConversionRate::class, + [ + 'base_currency_id' => 1, + 'target_currency_id' => 3, + ], + ); + + // etc. + } +} diff --git a/tests/Unit/Jobs/FetchConversionRatesTest.php b/tests/Unit/Jobs/FetchConversionRatesTest.php new file mode 100644 index 00000000..e52fd015 --- /dev/null +++ b/tests/Unit/Jobs/FetchConversionRatesTest.php @@ -0,0 +1,22 @@ +call([new FetchConversionRates(), 'handle']); + + Queue::assertPushed(FetchConversionRate::class); + } +}