Skip to content

Commit

Permalink
rename postfix param to suffix (#10667)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s authored Nov 11, 2024
1 parent 04638ab commit 2bd926e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions services/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function rangeStart(v) {
* @param {string} [options.tag] - The tag to display on the badge, such as "alpha" or "beta"
* @param {string} [options.defaultLabel] - The default label to display on the badge, such as "npm" or "github"
* @param {string} [options.prefix] - The prefix to display on the message, such as ">=", "v", overrides the default behavior of using addv
* @param {string} [options.postfix] - The postfix to display on the message, such as "tested"
* @param {string} [options.suffix] - The suffix to display on the message, such as "tested"
* @param {Function} [options.versionFormatter=versionColor] - The function to use to format the color of the badge based on the version number
* @param {boolean} [options.isPrerelease] - Whether the version is explicitly marked as a prerelease by upstream API
* @returns {object} A badge object that has three properties: label, message, and color
Expand All @@ -249,15 +249,15 @@ function renderVersionBadge({
tag,
defaultLabel,
prefix,
postfix,
suffix,
versionFormatter = versionColor,
isPrerelease,
}) {
return {
label: tag ? `${defaultLabel}@${tag}` : defaultLabel,
message:
(prefix ? `${prefix}${version}` : addv(version)) +
(postfix ? ` ${postfix}` : ''),
(suffix ? ` ${suffix}` : ''),
color: versionFormatter(isPrerelease ? 'pre' : version),
}
}
Expand Down
8 changes: 4 additions & 4 deletions services/version.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('Version helpers', function () {
message: 'v1.2.3',
color: 'blue',
})
given({ version: '1.2.3', postfix: 'tested' }).expect({
given({ version: '1.2.3', suffix: 'tested' }).expect({
label: undefined,
message: 'v1.2.3 tested',
color: 'blue',
Expand All @@ -164,7 +164,7 @@ describe('Version helpers', function () {
version: '1.2.3',
tag: 'beta',
defaultLabel: 'github',
postfix: 'tested',
suffix: 'tested',
}).expect({
label: 'github@beta',
message: 'v1.2.3 tested',
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('Version helpers', function () {
given({
version: '1.2.3',
prefix: '^',
postfix: 'tested',
suffix: 'tested',
}).expect({
label: undefined,
message: '^1.2.3 tested',
Expand All @@ -208,7 +208,7 @@ describe('Version helpers', function () {
tag: 'beta',
defaultLabel: 'github',
prefix: '^',
postfix: 'tested',
suffix: 'tested',
}).expect({
label: 'github@beta',
message: '^1.2.3 tested',
Expand Down
2 changes: 1 addition & 1 deletion services/wordpress/wordpress-platform.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class WordpressPluginTestedVersion extends BaseWordpress {
const color = await versionColorForWordpressVersion(testedVersion)
return renderVersionBadge({
version: testedVersion,
postfix: 'tested',
suffix: 'tested',
versionFormatter: () => color,
})
}
Expand Down

0 comments on commit 2bd926e

Please sign in to comment.