Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds more info for release URL (#11492)
* Add getReleaseUrl function * Implement * Add emoji * tmp * Update jest * Test works * Add comment * Empty lines to tigger netlify build Co-authored-by: fisker Cheung <lionkay@gmail.com>
- Loading branch information
1 parent
5ce28dd
commit 96795dc
Showing
9 changed files
with
429 additions
and
341 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { jest } from "@jest/globals"; | ||
|
||
jest.unstable_mockModule("../get-formatted-date", () => ({ | ||
default: () => ({ | ||
year: "2021", | ||
month: "09", | ||
day: "01", | ||
}), | ||
})); |
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,26 @@ | ||
import { getReleaseUrl } from "../../steps/publish-to-npm.js"; | ||
|
||
describe("publish-to-npm", () => { | ||
describe("getReleaseUrl", () => { | ||
it("returns URL for patch releasing", () => { | ||
const result = getReleaseUrl("2.3.1", "2.3.0"); | ||
expect(result).toBe( | ||
"https://github.com/prettier/prettier/releases/new?tag=2.3.1&title=2.3.1&body=%F0%9F%94%97%20%5BChangelog%5D(https%3A%2F%2Fgithub.com%2Fprettier%2Fprettier%2Fblob%2Fmain%2FCHANGELOG.md%23231)" | ||
); | ||
}); | ||
|
||
it("returns URL for minor releasing", () => { | ||
const result = getReleaseUrl("2.4.0", "2.3.0"); | ||
expect(result).toBe( | ||
"https://github.com/prettier/prettier/releases/new?tag=2.4.0&title=2.4.0&body=%5Bdiff%5D(https%3A%2F%2Fgithub.com%2Fprettier%2Fprettier%2Fcompare%2F2.3.0...2.4.0)%0A%0A%F0%9F%94%97%20%5BRelease%20note%5D(https%3A%2F%2Fprettier.io%2Fblog%2F2021%2F09%2F01%2F2.4.0.html)" | ||
); | ||
}); | ||
|
||
it("returns URL for major releasing", () => { | ||
const result = getReleaseUrl("2.3.0", "2.2.0"); | ||
expect(result).toBe( | ||
"https://github.com/prettier/prettier/releases/new?tag=2.3.0&title=2.3.0&body=%5Bdiff%5D(https%3A%2F%2Fgithub.com%2Fprettier%2Fprettier%2Fcompare%2F2.2.0...2.3.0)%0A%0A%F0%9F%94%97%20%5BRelease%20note%5D(https%3A%2F%2Fprettier.io%2Fblog%2F2021%2F09%2F01%2F2.3.0.html)" | ||
); | ||
}); | ||
}); | ||
}); |
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,8 @@ | ||
// TODO: Implement this in `utils.js` when jest.importActual is landed. | ||
export default function getFormattedDate() { | ||
const date = new Date(); | ||
const year = date.getFullYear(); | ||
const month = String(date.getMonth() + 1).padStart(2, "0"); | ||
const day = String(date.getDate()).padStart(2, "0"); | ||
return { year, month, day }; | ||
} |
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,6 @@ | ||
const config = { | ||
testMatch: ["<rootDir>/__tests__/**/*.spec.js"], | ||
setupFiles: ["<rootDir>/__tests__/setup.js"], | ||
}; | ||
|
||
export default config; |
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.