Skip to content

Commit

Permalink
Fix tests failed issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakvGhost committed Nov 17, 2023
1 parent 777f26b commit 5914c8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
File renamed without changes.
File renamed without changes.
15 changes: 4 additions & 11 deletions tests/Feature/RuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@

it('validates in rule successfully', function () {
$validValues = ['value1', 'value2', 'value3'];
$validator = new InRule([$validValues]);
$validator = new InRule($validValues);

expect($validator->passes('field', 'value2', []))->toBeTrue();
expect($validator->passes('field', 'invalidValue', []))->toBeFalse();
Expand Down Expand Up @@ -217,22 +217,15 @@
it('validates active URL rule successfully', function () {
$validator = new ActiveURLRule([]);

$data = [];

// When the URL is valid and has an active DNS record, the validation should pass.
$data = [
'field' => 'https://www.example.com',
];
expect($validator->passes('field', 'https://www.example.com', $data))->toBeTrue();
expect($validator->passes('field', 'https://example.com', $data))->toBeTrue();

// When the URL is valid but doesn't have an active DNS record, the validation should fail.
$data = [
'field' => 'https://nonexistent.example.com',
];
expect($validator->passes('field', 'https://nonexistent.example.com', $data))->toBeFalse();

// When the URL is not valid, the validation should fail.
$data = [
'field' => 'invalid-url',
];
expect($validator->passes('field', 'invalid-url', $data))->toBeFalse();

expect($validator->message())->toBe(
Expand Down

0 comments on commit 5914c8d

Please sign in to comment.