forked from badges/shields
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to format bytes as metric or IEC; affects [bundlejs bundl…
…ephobia ChromeWebStoreSize CratesSize DockerSize GithubRepoSize GithubCodeSize GithubSize NpmUnpackedSize SpigetDownloadSize steam VisualStudioAppCenterReleasesSize whatpulse] (badges#10547) * add renderSizeBadge helper, use it everywhere - switch from pretty-bytes to byte-size - add renderSizeBadge() helper function - match upstream conventions for metric/IEC units - add new test helpers and use them in service tests * unrelated: fix npm unpacked size query param schema not strictly related to this PR but I noticed it was broken * chromewebstore: reformat size string, test against isIecFileSize
- Loading branch information
Showing
28 changed files
with
142 additions
and
144 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import { isFileSize } from '../test-validators.js' | ||
import { isMetricFileSize } from '../test-validators.js' | ||
import { createServiceTester } from '../tester.js' | ||
export const t = await createServiceTester() | ||
|
||
t.create('bundlejs/package (packageName)') | ||
.get('/jquery.json') | ||
.expectBadge({ label: 'minified size (gzip)', message: isFileSize }) | ||
.expectBadge({ label: 'minified size (gzip)', message: isMetricFileSize }) | ||
|
||
t.create('bundlejs/package (version)') | ||
.get('/[email protected]') | ||
.expectBadge({ label: 'minified size (gzip)', message: isFileSize }) | ||
.expectBadge({ label: 'minified size (gzip)', message: isMetricFileSize }) | ||
|
||
t.create('bundlejs/package (scoped)') | ||
.get('/@cycle/rx-run.json') | ||
.expectBadge({ label: 'minified size (gzip)', message: isFileSize }) | ||
.expectBadge({ label: 'minified size (gzip)', message: isMetricFileSize }) | ||
|
||
t.create('bundlejs/package (select exports)') | ||
.get('/value-enhancer.json?exports=isVal,val') | ||
.expectBadge({ label: 'minified size (gzip)', message: isFileSize }) | ||
.expectBadge({ label: 'minified size (gzip)', message: isMetricFileSize }) | ||
|
||
t.create('bundlejs/package (scoped version select exports)') | ||
.get('/@ngneat/[email protected]?exports=randEmail,randFullName') | ||
.expectBadge({ label: 'minified size (gzip)', message: isFileSize }) | ||
.expectBadge({ label: 'minified size (gzip)', message: isMetricFileSize }) | ||
|
||
t.create('bundlejs/package (not found)') | ||
.get('/[email protected]') | ||
|
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
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
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
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
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
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
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
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
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
Oops, something went wrong.