Skip to content

Commit

Permalink
Extract helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Apr 24, 2024
1 parent 5c08094 commit 1287206
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/Unit/Support/GitHubReleaseDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use App\Commands\Internal\Support\GitHubReleaseAsset;

it('creates a GitHubRelease object from JSON data', function () {
expect(new GitHubReleaseData(fixture('github-release-api-sample-response.json')))
expect(getGitHubReleaseData())
->toBeInstanceOf(GitHubReleaseData::class);
});

Expand All @@ -14,13 +14,13 @@
});

it('constructs semver tag', function () {
$release = new GitHubReleaseData(fixture('github-release-api-sample-response.json'));
$release = getGitHubReleaseData();

expect($release->tag)->toBe('v1.0.0');
});

it('constructs assets', function () {
$release = new GitHubReleaseData(fixture('github-release-api-sample-response.json'));
$release = getGitHubReleaseData();

expect($release->assets)
->toHaveCount(1)
Expand All @@ -47,3 +47,8 @@
array_shift($data);
new GitHubReleaseAsset($data);
})->throws(InvalidArgumentException::class);

function getGitHubReleaseData(): GitHubReleaseData
{
return new GitHubReleaseData(fixture('github-release-api-sample-response.json'));
}

0 comments on commit 1287206

Please sign in to comment.