-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
service tests for packagist-dependency-version.service.js are in prog…
…ress
- Loading branch information
1 parent
6fe762e
commit 55f50ce
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { isComposerVersion } from '../test-validators.js' | ||
import { createServiceTester } from '../tester.js' | ||
export const t = await createServiceTester() | ||
|
||
t.create('gets the package version of symfony') | ||
.get('/symfony/symfony.json?dependencyVendor=twig&dependencyRepo=twig') | ||
.expectBadge({ label: 'twig/twig', message: isComposerVersion }) | ||
|
||
t.create('gets the package version of symfony 5.2.3') | ||
.get('/symfony/symfony/v5.2.3.json?dependencyVendor=twig&dependencyRepo=twig') | ||
.expectBadge({ label: 'twig/twig', message: isComposerVersion }) | ||
|
||
t.create('package with no requirements') | ||
.get('/bpampuch/pdfmake.json?dependencyVendor=twig&dependencyRepo=twig') | ||
.expectBadge({ | ||
label: 'dependency version', | ||
message: 'version requirement not found', | ||
}) | ||
|
||
t.create('package with no twig/twig version requirement') | ||
.get( | ||
'/raulfraile/ladybug-theme-modern.json?dependencyVendor=twig&dependencyRepo=twig' | ||
) | ||
.expectBadge({ | ||
label: 'dependency version', | ||
message: 'version requirement not found', | ||
}) | ||
|
||
t.create('invalid package name') | ||
.get('/frodo/is-not-a-package.json?dependencyVendor=twig&dependencyRepo=twig') | ||
.expectBadge({ label: 'dependency version', message: 'not found' }) | ||
|
||
t.create('invalid version') | ||
.get( | ||
'/symfony/symfony/invalid.json?dependencyVendor=twig&dependencyRepo=twig' | ||
) | ||
.expectBadge({ label: 'dependency version', message: 'invalid version' }) | ||
|
||
t.create('custom server') | ||
.get( | ||
'/symfony/symfony.json?server=https%3A%2F%2Fpackagist.org&dependencyVendor=twig&dependencyRepo=twig' | ||
) | ||
.expectBadge({ label: 'twig/twig', message: isComposerVersion }) | ||
|
||
t.create('invalid custom server') | ||
.get( | ||
'/symfony/symfony.json?server=https%3A%2F%2Fpackagist.com&dependencyVendor=twig&dependencyRepo=twig' | ||
) | ||
.expectBadge({ label: 'dependency version', message: 'not found' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters