Skip to content

Commit 4d1b5db

Browse files
committed
Add test for payment description
1 parent 317e555 commit 4d1b5db

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

tests/OperationsWithFacadeTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,16 @@
9494
expect(LaravelPayPocket::walletBalanceByType($user, 'wallet_2'))->toBeFloat(0.12);
9595

9696
expect(LaravelPayPocket::checkBalance($user))->toBeFloat(0.12);
97-
});
97+
});
98+
99+
test('description can be added during payment', function () {
100+
$user = User::factory()->create();
101+
102+
$type = 'wallet_2';
103+
104+
$description = \Illuminate\Support\Str::random();
105+
LaravelPayPocket::deposit($user, $type, 234.56);
106+
LaravelPayPocket::pay($user, 234.56, $description);
107+
108+
expect(WalletsLog::where('notes', $description)->exists())->toBe(true);
109+
});

tests/OperationsWithoutFacadeTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
expect($user->getWalletBalanceByType('wallet_2'))->toBeFloat(234.56);
1818

1919
expect($user->walletBalance)->toBeFloat(234.56);
20-
2120
});
2221

2322
test('user can deposit two times', function () {
@@ -33,7 +32,6 @@
3332
expect($user->getWalletBalanceByType('wallet_2'))->toBeFloat(1023.68);
3433

3534
expect($user->walletBalance)->toBeFloat(1023.68);
36-
3735
});
3836

3937
test('user can pay order', function () {
@@ -98,3 +96,15 @@
9896

9997
expect($user->walletBalance)->toBeFloat(0.12);
10098
});
99+
100+
test('description can be added during payment', function () {
101+
$user = User::factory()->create();
102+
103+
$type = 'wallet_2';
104+
105+
$description = \Illuminate\Support\Str::random();
106+
$user->deposit($type, 234.56);
107+
$user->pay(234.56, $description);
108+
109+
expect(WalletsLog::where('notes', $description)->exists())->toBe(true);
110+
});

0 commit comments

Comments
 (0)