Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Oct 18, 2024
1 parent fd17937 commit 1fc425a
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from "react";
import fetchMock from "fetch-mock-jest";
import { render, screen, waitForElementToBeRemoved } from "jest-matrix-react";

import ChangelogDialog from "../../../../../src/components/views/dialogs/ChangelogDialog";
import ChangelogDialog, { parseVersion } from "../../../../../src/components/views/dialogs/ChangelogDialog";

describe("<ChangelogDialog />", () => {
it("should fetch github proxy url for each repo with old and new version strings", async () => {
Expand Down Expand Up @@ -78,3 +78,24 @@ describe("<ChangelogDialog />", () => {
expect(asFragment()).toMatchSnapshot();
});
});

describe("parseVersion", () => {
it("should return null for old-style version strings", () => {
expect(parseVersion("aaaabbbb-react-ccccdddd-js-eeeeffff")).toBeNull();
});

it("should return null for invalid version strings", () => {
expect(parseVersion("aaaabbbb-react-ccccdddd")).toBeNull();
});

it("should return null for release version strings", () => {
expect(parseVersion("v1.22.33")).toBeNull();
});

it("should return mapping for develop version string", () => {
expect(parseVersion("aaaabbbb-js-eeeeffff")).toEqual({
"element-hq/element-web": "aaaabbbb",
"matrix-org/matrix-js-sdk": "eeeeffff",
});
});
});

0 comments on commit 1fc425a

Please sign in to comment.