Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacastelnuovo committed Mar 1, 2024
1 parent cd65296 commit ba122d0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/LaravelAgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,19 @@
$encrypted = $age->encrypt($message);
$decrypted = $age->decrypt($encrypted);
})->throws(Exception::class);

it('runs usage code from readme', function () {
$message = 'Hello World!';

$age = LaravelAge::generateKeypair();
$privateKey = $age->getPrivateKey();
$publicKey = $age->getPublicKey();

$age2 = new LaravelAge(publicKey: $publicKey);
$encrypted_message = $age2->encrypt($message);

$age3 = new LaravelAge(privateKey: $privateKey);
$decrypted_message = $age3->decrypt($encrypted_message);

expect($message)->toBe($decrypted_message);
});

0 comments on commit ba122d0

Please sign in to comment.