Skip to content

Commit

Permalink
Fixed thing
Browse files Browse the repository at this point in the history
  • Loading branch information
syropian committed Apr 1, 2024
1 parent a8e92fb commit a0eae42
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
4 changes: 2 additions & 2 deletions tests/Feature/Controllers/StarTagsController/StoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
->post(route('star.tags.store'), ['tagId' => $this->tag->id, 'repos' => $badData])
->assertInvalid($errors);
})->with([
fn () => [[[...$this->metaWithoutUrl, 'description' => 12345]], 'repos.0.description'],
fn () => [[[...$this->metaWithoutUrl, 'description' => []]], 'repos.0.description'],
fn () => [[[...$this->meta, 'description' => 12345]], 'repos.0.description'],
fn () => [[[...$this->meta, 'description' => []]], 'repos.0.description'],
]);
});
44 changes: 35 additions & 9 deletions tests/Feature/Controllers/StarTagsController/UpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,40 @@
])
->assertInvalid($errors);
})->with([
fn () => [[$this->metaWithoutDatabaseId], 'nameWithOwner'],
fn () => [[[...$this->metaWithoutDatabaseId, 'nameWithOwner' => 420]], 'nameWithOwner'],
fn () => [[[...$this->metaWithoutDatabaseId, 'nameWithOwner' => null]], 'nameWithOwner'],
fn () => [[[...$this->metaWithoutDatabaseId, 'nameWithOwner' => []]], 'nameWithOwner'],
fn () => [[$this->metaWithoutNameWithOwner], 'nameWithOwner'],
fn () => [[[...$this->metaWithoutNameWithOwner, 'nameWithOwner' => 420]], 'nameWithOwner'],
fn () => [[[...$this->metaWithoutNameWithOwner, 'nameWithOwner' => null]], 'nameWithOwner'],
fn () => [[[...$this->metaWithoutNameWithOwner, 'nameWithOwner' => []]], 'nameWithOwner'],
]);
});

it('requires a valid `url` value')->todo();
it('validates the `description` value if present')->todo();
it('validates the tags are an array')->todo();
it('validates that each tag has a valid `name` value')->todo();
it('requires a valid `url` value', function ($badData, array|string $errors) {
$this
->put(route('star.tags.update'), [
...$badData,
'tags' => [['name' => 'Livestreaming']],
])
->assertInvalid($errors);
})
->with([
fn () => [[$this->metaWithoutUrl], 'url'],
fn () => [[[...$this->metaWithoutUrl, 'url' => 420]], 'url'],
fn () => [[[...$this->metaWithoutUrl, 'url' => 'foobar']], 'url'],
fn () => [[[...$this->metaWithoutUrl, 'url' => null]], 'url'],
fn () => [[[...$this->metaWithoutUrl, 'url' => []]], 'url'],
]);

it('validates the `description` value if present', function ($badData, array|string $errors) {
$this
->put(route('star.tags.update'), [
...$badData,
'tags' => [['name' => 'Livestreaming']],
])->assertInvalid($errors);
})
->with([
fn () => [[...$this->meta, 'description' => 12345], 'description'],
fn () => [[...$this->meta, 'description' => []], 'description'],
]);

it('validates the tags are an array')->todo();
it('validates that each tag has a valid `name` value')->todo();
});

0 comments on commit a0eae42

Please sign in to comment.