Skip to content

Commit

Permalink
Add Tests > When price estimation has params
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelstz authored Aug 24, 2024
1 parent 276831e commit c54aa4e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/Unit/Services/Price/PriceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,26 @@

})->with('authentication', 'serviceCode', 'originCep', 'destinyCep');

test('It should be possible to use the get() method with optional dimensions without generate any Exception or empty array', function(Authentication $authentication, string $serviceCode, string $originCep, string $destinyCep) {
$price = new Price($authentication, time());
expect(
fn() => $price->get(
[$serviceCode],
[[
'weight' => fake()->randomFloat(1,1, 1000),
'width' => fake()->randomFloat(1,10, 20),
'height' => fake()->randomFloat(1,10, 20),
'length' => fake()->randomFloat(1,10, 20),
]],
$originCep,
$destinyCep
)
)
->not->toBeEmpty()
->not->toThrow(Exception::class);

})->with('authentication', 'serviceCode', 'originCep', 'destinyCep');

test('The get() method should generate an InvalidCepException when we use an invalid CEP', function(Authentication $authentication, string $serviceCode, string $destinyCep) {
$price = new Price($authentication, time());
expect(
Expand Down

0 comments on commit c54aa4e

Please sign in to comment.