-
-
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.
chore(deps): bump webextension-store-meta from 1.0.5 to 1.1.0; run [c…
…hromewebstore] (#9972) * chore(deps): bump webextension-store-meta from 1.0.5 to 1.1.0 Bumps [webextension-store-meta](https://github.com/awesome-webextension/webextension-store-meta) from 1.0.5 to 1.1.0. - [Changelog](https://github.com/awesome-webextension/webextension-store-meta/blob/main/CHANGELOG.md) - [Commits](https://github.com/awesome-webextension/webextension-store-meta/commits) --- updated-dependencies: - dependency-name: webextension-store-meta dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * deprecate price badge `price` and `priceCurrency` fields have been removed * fix formatting on users badge --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: chris48s <git@chris-shaw.dev>
- Loading branch information
1 parent
c4062a7
commit a68e47c
Showing
5 changed files
with
27 additions
and
62 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
45 changes: 8 additions & 37 deletions
45
services/chrome-web-store/chrome-web-store-price.service.js
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,39 +1,10 @@ | ||
import { currencyFromCode } from '../text-formatters.js' | ||
import { NotFound, pathParams } from '../index.js' | ||
import BaseChromeWebStoreService from './chrome-web-store-base.js' | ||
import { deprecatedService } from '../index.js' | ||
|
||
export default class ChromeWebStorePrice extends BaseChromeWebStoreService { | ||
static category = 'funding' | ||
static route = { base: 'chrome-web-store/price', pattern: ':storeId' } | ||
const ChromeWebStorePrice = deprecatedService({ | ||
category: 'funding', | ||
route: { base: 'chrome-web-store/price', pattern: ':storeId' }, | ||
label: 'price', | ||
dateAdded: new Date('2024-02-18'), | ||
}) | ||
|
||
static openApi = { | ||
'/chrome-web-store/price/{storeId}': { | ||
get: { | ||
summary: 'Chrome Web Store Price', | ||
parameters: pathParams({ | ||
name: 'storeId', | ||
example: 'ogffaloegjglncjfehdfplabnoondfjo', | ||
}), | ||
}, | ||
}, | ||
} | ||
|
||
static defaultBadgeData = { label: 'price' } | ||
|
||
static render({ priceCurrency, price }) { | ||
return { | ||
message: `${currencyFromCode(priceCurrency) + price}`, | ||
color: 'brightgreen', | ||
} | ||
} | ||
|
||
async handle({ storeId }) { | ||
const chromeWebStore = await this.fetch({ storeId }) | ||
const priceCurrency = chromeWebStore.priceCurrency() | ||
const price = chromeWebStore.price() | ||
if (priceCurrency == null || price == null) { | ||
throw new NotFound({ prettyMessage: 'not found' }) | ||
} | ||
return this.constructor.render({ priceCurrency, price }) | ||
} | ||
} | ||
export default ChromeWebStorePrice |
28 changes: 10 additions & 18 deletions
28
services/chrome-web-store/chrome-web-store-price.tester.js
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,20 +1,12 @@ | ||
import Joi from 'joi' | ||
import { createServiceTester } from '../tester.js' | ||
export const t = await createServiceTester() | ||
import { ServiceTester } from '../tester.js' | ||
|
||
t.create('Price') | ||
.get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json') | ||
.expectBadge({ | ||
label: 'price', | ||
message: Joi.string().regex(/^\$\d+(.\d{1,2})?$/), | ||
}) | ||
export const t = new ServiceTester({ | ||
id: 'ChromeWebStorePrice', | ||
title: 'ChromeWebStorePrice', | ||
pathPrefix: '/chrome-web-store/price', | ||
}) | ||
|
||
t.create('Price (not found)') | ||
.get('/invalid-name-of-addon.json') | ||
.expectBadge({ label: 'price', message: 'not found' }) | ||
|
||
// Keep this "inaccessible" test, since this service does not use BaseService#_request. | ||
t.create('Price (inaccessible)') | ||
.get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json') | ||
.networkOff() | ||
.expectBadge({ label: 'price', message: 'inaccessible' }) | ||
t.create('Price').get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json').expectBadge({ | ||
label: 'price', | ||
message: 'no longer available', | ||
}) |
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