Skip to content

Commit fb2eb07

Browse files
committed
add units
1 parent ee1edda commit fb2eb07

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/Units/Domain/BalanceTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,39 @@ public function testDepositWalletExists(): void
3030
self::assertTrue($buyer->wallet->exists);
3131
}
3232

33+
public function testDecimalPlaces(): void
34+
{
35+
config([
36+
'wallet.wallet.creating' => [
37+
'decimal_places' => 3,
38+
],
39+
]);
40+
41+
/** @var Buyer $buyer */
42+
$buyer = BuyerFactory::new()->create();
43+
self::assertFalse($buyer->relationLoaded('wallet'));
44+
$buyer->deposit(1);
45+
46+
self::assertSame(3, $buyer->wallet->decimal_places);
47+
}
48+
49+
/**
50+
* @see https://github.com/bavix/laravel-wallet/issues/498
51+
*/
52+
public function testMetaModify(): void
53+
{
54+
/** @var Buyer $buyer */
55+
$buyer = BuyerFactory::new()->create();
56+
$transaction = $buyer->deposit(1000);
57+
self::assertNotNull($transaction);
58+
59+
$transaction->meta = array_merge($transaction->meta ?? [], [
60+
'description' => 'Your transaction has been approved',
61+
]);
62+
63+
self::assertTrue($transaction->save());
64+
}
65+
3366
public function testCheckType(): void
3467
{
3568
/** @var Buyer $buyer */

0 commit comments

Comments
 (0)