Update tests, apply formatting
This commit is contained in:
parent
f469c1de67
commit
786aca82f1
12 changed files with 70 additions and 24 deletions
|
@ -64,7 +64,7 @@ it("isBetween test", () => {
|
|||
});
|
||||
|
||||
it("getExtension test", () => {
|
||||
expect(getExtension(0)).toEqual("");
|
||||
expect(getExtension(0)).toEqual("th");
|
||||
expect(getExtension(1)).toEqual("st");
|
||||
expect(getExtension(2)).toEqual("nd");
|
||||
expect(getExtension(3)).toEqual("rd");
|
||||
|
|
|
@ -7,6 +7,7 @@ import SearchBar, {
|
|||
|
||||
const props: ISearchProps = {
|
||||
defaultProvider: "https://test.com?q=",
|
||||
placeholder: "",
|
||||
providers: [
|
||||
{
|
||||
name: "Allmusic",
|
||||
|
@ -73,6 +74,7 @@ describe("searchBar.tsx", () => {
|
|||
it("Tests handleQueryWithProvider without providers", () => {
|
||||
const test: ISearchProps = {
|
||||
defaultProvider: "https://test.com?q=",
|
||||
placeholder: "",
|
||||
providers: undefined,
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ const themes: Array<IThemeProps> = [
|
|||
|
||||
const search: ISearchProps = {
|
||||
defaultProvider: "https://test.com?q=",
|
||||
placeholder: "",
|
||||
providers: [
|
||||
{
|
||||
name: "Allmusic",
|
||||
|
@ -130,10 +131,23 @@ describe("settings.tsx", () => {
|
|||
expect(window.location.reload).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("Tests theme selection", () => {
|
||||
it("Tests light theme selection", () => {
|
||||
const settings = render(<Settings themes={themes} search={search} />);
|
||||
|
||||
fireEvent.change(settings.getByTestId("select"), { target: { value: 0 } });
|
||||
fireEvent.change(settings.getByTestId("select-light"), {
|
||||
target: { value: 0 },
|
||||
});
|
||||
|
||||
fireEvent.click(settings.getByTestId("button-submit"));
|
||||
expect(window.location.reload).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("Tests dark theme selection", () => {
|
||||
const settings = render(<Settings themes={themes} search={search} />);
|
||||
|
||||
fireEvent.change(settings.getByTestId("select-dark"), {
|
||||
target: { value: 0 },
|
||||
});
|
||||
|
||||
fireEvent.click(settings.getByTestId("button-submit"));
|
||||
expect(window.location.reload).toHaveBeenCalledTimes(1);
|
||||
|
@ -142,7 +156,9 @@ describe("settings.tsx", () => {
|
|||
it("Tests theme selection", () => {
|
||||
const settings = render(<Settings themes={themes} search={search} />);
|
||||
|
||||
fireEvent.change(settings.getByTestId("select"), { target: { value: 5 } });
|
||||
fireEvent.change(settings.getByTestId("select-light"), {
|
||||
target: { value: 5 },
|
||||
});
|
||||
|
||||
fireEvent.click(settings.getByTestId("button-submit"));
|
||||
expect(window.location.reload).toHaveBeenCalledTimes(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue