-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: unit coverage for
MemoryWallet
(#356)
- Loading branch information
1 parent
58576eb
commit 46fb566
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use App\DTO\MemoryWallet; | ||
use App\Services\Cache\WalletCache; | ||
|
||
it('should make an instance from a address', function () { | ||
$subject = MemoryWallet::fromAddress('D6Z26L69gdk9qYmTv5uzk3uGepigtHY4ax'); | ||
|
||
expect($subject->address())->toBe('D6Z26L69gdk9qYmTv5uzk3uGepigtHY4ax'); | ||
expect($subject->publicKey())->toBeNull(); | ||
expect($subject->username())->toBeNull(); | ||
expect($subject->isDelegate())->toBeFalse(); | ||
}); | ||
|
||
it('should make an instance from a public key', function () { | ||
$subject = MemoryWallet::fromPublicKey('03d3fdad9c5b25bf8880e6b519eb3611a5c0b31adebc8455f0e096175b28321aff'); | ||
|
||
expect($subject->address())->toBe('D6Z26L69gdk9qYmTv5uzk3uGepigtHY4ax'); | ||
expect($subject->publicKey())->toBe('03d3fdad9c5b25bf8880e6b519eb3611a5c0b31adebc8455f0e096175b28321aff'); | ||
expect($subject->username())->toBeNull(); | ||
expect($subject->isDelegate())->toBeFalse(); | ||
}); | ||
|
||
it('should be a delegate', function () { | ||
(new WalletCache())->setUsernameByAddress('D6Z26L69gdk9qYmTv5uzk3uGepigtHY4ax', 'username'); | ||
|
||
$subject = MemoryWallet::fromPublicKey('03d3fdad9c5b25bf8880e6b519eb3611a5c0b31adebc8455f0e096175b28321aff'); | ||
|
||
expect($subject->address())->toBe('D6Z26L69gdk9qYmTv5uzk3uGepigtHY4ax'); | ||
expect($subject->publicKey())->toBe('03d3fdad9c5b25bf8880e6b519eb3611a5c0b31adebc8455f0e096175b28321aff'); | ||
expect($subject->username())->toBe('username'); | ||
expect($subject->isDelegate())->toBeTrue(); | ||
}); |