-
-
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.
allow [chromewebstore] size to contain decimal point (#10812)
* allow [chromewebstore] size to contain decimal point * Update services/chrome-web-store/chrome-web-store-size.service.js Co-authored-by: jNullj <[email protected]> * Update services/chrome-web-store/chrome-web-store-size.spec.js Co-authored-by: jNullj <[email protected]> * prettier --------- Co-authored-by: jNullj <[email protected]>
- Loading branch information
Showing
2 changed files
with
31 additions
and
3 deletions.
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
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,28 @@ | ||
import { expect } from 'chai' | ||
import { test, given } from 'sazerac' | ||
import { InvalidResponse } from '../index.js' | ||
import ChromeWebStoreSize from './chrome-web-store-size.service.js' | ||
|
||
describe('transform function', function () { | ||
it('formats size correctly', function () { | ||
test(ChromeWebStoreSize.transform, () => { | ||
given('0.55KiB').expect('0.55 KiB') | ||
given('19.86KiB').expect('19.86 KiB') | ||
given('432KiB').expect('432 KiB') | ||
}) | ||
}) | ||
|
||
it('throws when the format is unexpected', function () { | ||
expect(() => ChromeWebStoreSize.transform('432 KiB')).to.throw( | ||
InvalidResponse, | ||
) | ||
expect(() => ChromeWebStoreSize.transform('432')).to.throw(InvalidResponse) | ||
expect(() => ChromeWebStoreSize.transform('KiB')).to.throw(InvalidResponse) | ||
expect(() => ChromeWebStoreSize.transform('foobar')).to.throw( | ||
InvalidResponse, | ||
) | ||
expect(() => ChromeWebStoreSize.transform('4.4.4 KiB')).to.throw( | ||
InvalidResponse, | ||
) | ||
}) | ||
}) |