FBOS beta tag name fetch fix
parent
3976d0767c
commit
bbc2b24ea7
|
@ -364,17 +364,21 @@ describe("fetchReleases()", () => {
|
|||
});
|
||||
|
||||
describe("fetchLatestGHBetaRelease()", () => {
|
||||
it("fetches latest beta OS release version", async () => {
|
||||
mockGetRelease = Promise.resolve({ data: [{ tag_name: "v1.0.0-beta" }] });
|
||||
const dispatch = jest.fn();
|
||||
await actions.fetchLatestGHBetaRelease("url/001")(dispatch);
|
||||
expect(axios.get).toHaveBeenCalledWith("url");
|
||||
expect(error).not.toHaveBeenCalled();
|
||||
expect(dispatch).toHaveBeenCalledWith({
|
||||
payload: { version: "1.0.0-beta", commit: undefined },
|
||||
type: Actions.FETCH_BETA_OS_UPDATE_INFO_OK
|
||||
const testFetchBeta = (tag_name: string, version: string) =>
|
||||
it(`fetches latest beta OS release version: ${tag_name}`, async () => {
|
||||
mockGetRelease = Promise.resolve({ data: [{ tag_name }] });
|
||||
const dispatch = jest.fn();
|
||||
await actions.fetchLatestGHBetaRelease("url/001")(dispatch);
|
||||
expect(axios.get).toHaveBeenCalledWith("url");
|
||||
expect(error).not.toHaveBeenCalled();
|
||||
expect(dispatch).toHaveBeenCalledWith({
|
||||
payload: { version, commit: undefined },
|
||||
type: Actions.FETCH_BETA_OS_UPDATE_INFO_OK
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
testFetchBeta("v1.0.0-beta", "1.0.0-beta");
|
||||
testFetchBeta("v1.0.0-rc1", "1.0.0-rc1");
|
||||
|
||||
it("fails to fetches latest beta OS release version", async () => {
|
||||
mockGetRelease = Promise.reject("error");
|
||||
|
|
|
@ -180,8 +180,8 @@ export const fetchLatestGHBetaRelease =
|
|||
axios
|
||||
.get<GithubRelease[]>(releasesURL)
|
||||
.then(resp => {
|
||||
const latestBeta = resp.data
|
||||
.filter(x => x.tag_name.includes("beta"))[0];
|
||||
const latestBeta = resp.data.filter(x =>
|
||||
x.tag_name.includes("beta") || x.tag_name.includes("rc"))[0];
|
||||
const { tag_name, target_commitish } = latestBeta;
|
||||
const version = tagNameToVersionString(tag_name);
|
||||
dispatch({
|
||||
|
|
Loading…
Reference in New Issue