mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 21:21:09 -04:00 
			
		
		
		
	solve unit tests
This commit is contained in:
		| @ -8,10 +8,10 @@ beforeEach(function () { | ||||
|     Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); | ||||
| }); | ||||
|  | ||||
| test('company has one customer', function () { | ||||
|     $company = Company::factory()->hasCustomer()->create(); | ||||
| test('company has many customers', function () { | ||||
|     $company = Company::factory()->hasCustomers()->create(); | ||||
|  | ||||
|     $this->assertTrue($company->customer()->exists()); | ||||
|     $this->assertTrue($company->customers()->exists()); | ||||
| }); | ||||
|  | ||||
| test('company has many company setings', function () { | ||||
|  | ||||
| @ -16,7 +16,7 @@ test('an exchange rate log belongs to company', function () { | ||||
|  | ||||
| test('add exchange rate log', function () { | ||||
|     $expense = Expense::factory()->create(); | ||||
|     $response = ExchangeRateLog::addExchangeRateLog($expense, $expense->currency_id); | ||||
|     $response = ExchangeRateLog::addExchangeRateLog($expense); | ||||
|  | ||||
|     $this->assertDatabaseHas('exchange_Rate_logs', [ | ||||
|         'exchange_rate' => $response->exchange_rate, | ||||
|  | ||||
| @ -10,8 +10,6 @@ use Illuminate\Support\Facades\Artisan; | ||||
| beforeEach(function () { | ||||
|     Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'UnitSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'PaymentMethodSeeder', '--force' => true]); | ||||
| }); | ||||
|  | ||||
| test('invoice has many invoice items', function () { | ||||
| @ -114,7 +112,7 @@ test('update invoice', function () { | ||||
|     array_push($newInvoice['items'], $item); | ||||
|     array_push($newInvoice['taxes'], $tax); | ||||
|  | ||||
|     $request = new Request(); | ||||
|     $request = new InvoicesRequest(); | ||||
|  | ||||
|     $request->replace($newInvoice); | ||||
|  | ||||
| @ -161,7 +159,7 @@ test('create items', function () { | ||||
|  | ||||
|     $request->replace(['items' => $items ]); | ||||
|  | ||||
|     Invoice::createItems($invoice, $request, $invoice->exchange_rate); | ||||
|     Invoice::createItems($invoice, $request->items); | ||||
|  | ||||
|     $this->assertDatabaseHas('invoice_items', [ | ||||
|         'invoice_id' => $invoice->id, | ||||
| @ -188,7 +186,7 @@ test('create taxes', function () { | ||||
|  | ||||
|     $request->replace(['taxes' => $taxes ]); | ||||
|  | ||||
|     Invoice::createTaxes($invoice, $request, $invoice->exchange_rate); | ||||
|     Invoice::createTaxes($invoice, $request->taxes); | ||||
|  | ||||
|     $this->assertDatabaseHas('taxes', [ | ||||
|         'invoice_id' => $invoice->id, | ||||
|  | ||||
| @ -10,7 +10,6 @@ use Illuminate\Support\Facades\Artisan; | ||||
| beforeEach(function () { | ||||
|     Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'UnitSeeder', '--force' => true]); | ||||
| }); | ||||
|  | ||||
| test('an item belongs to unit', function () { | ||||
|  | ||||
| @ -6,8 +6,6 @@ use Illuminate\Support\Facades\Artisan; | ||||
| beforeEach(function () { | ||||
|     Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'UnitSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'PaymentMethodSeeder', '--force' => true]); | ||||
| }); | ||||
|  | ||||
| test('payment method has many payment', function () { | ||||
|  | ||||
| @ -6,8 +6,6 @@ use Illuminate\Support\Facades\Artisan; | ||||
| beforeEach(function () { | ||||
|     Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'UnitSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'PaymentMethodSeeder', '--force' => true]); | ||||
| }); | ||||
|  | ||||
| test('payment belongs to invoice', function () { | ||||
|  | ||||
| @ -8,7 +8,6 @@ use Laravel\Sanctum\Sanctum; | ||||
| beforeEach(function () { | ||||
|     Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'UnitSeeder', '--force' => true]); | ||||
|  | ||||
|     $user = User::where('role', 'super admin')->first(); | ||||
|     $this->withHeaders([ | ||||
|  | ||||
		Reference in New Issue
	
	Block a user