From 8e5c6509c27cf935240fcac4fd85d994b0eaf7f7 Mon Sep 17 00:00:00 2001 From: karneaud Date: Fri, 19 Jul 2024 13:05:19 -0400 Subject: [PATCH] add test quickbooks ingest job --- .../Jobs/Import/QuickbooksIngestTest.php | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/Feature/Jobs/Import/QuickbooksIngestTest.php diff --git a/tests/Feature/Jobs/Import/QuickbooksIngestTest.php b/tests/Feature/Jobs/Import/QuickbooksIngestTest.php new file mode 100644 index 000000000000..a2bbdd4974c0 --- /dev/null +++ b/tests/Feature/Jobs/Import/QuickbooksIngestTest.php @@ -0,0 +1,53 @@ + config('ninja.db.default')]); + $this->makeTestData(); + $this->withoutExceptionHandling(); + Auth::setUser($this->user); + + } + + /** + * A basic feature test example. + */ + public function testCanQuickbooksIngest(): void + { + $data = (json_decode( file_get_contents( base_path('tests/Feature/Import/customers.json') ), true))['Customer']; + $hash = Str::random(32); + Cache::put($hash.'-client', base64_encode(json_encode($data)), 360); + QuickbooksIngest::dispatch([ + 'hash' => $hash, + 'column_map' => ['client' => ['mapping' => []]], + 'skip_header' => true, + 'import_type' => 'quickbooks', + ], $this->company )->handle(); + $this->assertTrue(Client::withTrashed()->where(['company_id' => $this->company->id, 'name' => "Freeman Sporting Goods"])->exists()); + } +}