refactor: Add getURL()
This commit is contained in:
parent
13ddb0fba5
commit
a488e041c8
4 changed files with 37 additions and 9 deletions
15
__tests__/get-url.test.js
Normal file
15
__tests__/get-url.test.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
const getURL = require("../lib/get-url");
|
||||
|
||||
describe("getURL()", () => {
|
||||
test("test", () => {
|
||||
const baseURL = "https://github.com/gohugoio/hugo/releases/download/v0.58.2";
|
||||
const urlLinux = `${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`;
|
||||
const urlLinuxExtended = `${baseURL}/hugo_extended_0.58.2_Linux-64bit.tar.gz`;
|
||||
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;
|
||||
const urlWindows = `${baseURL}/hugo_0.58.2_Windows-64bit.zip`;
|
||||
expect(getURL("Linux", false, "0.58.2")).toBe(urlLinux);
|
||||
expect(getURL("Linux", true, "0.58.2")).toBe(urlLinuxExtended);
|
||||
expect(getURL("macOS", false, "0.58.2")).toBe(urlMacOS);
|
||||
expect(getURL("Windows", false, "0.58.2")).toBe(urlWindows);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue