Update tests

This commit is contained in:
Bastian Meissner 2022-02-13 21:12:05 +01:00
parent 942cba97da
commit 6d059ce3b8
6 changed files with 114 additions and 22 deletions

View file

@ -1,3 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Greeter snapshot test 1`] = `[Function]`;
exports[`Greeter snapshot test with properties 1`] = `[Function]`;
exports[`Greeter snapshot test without properties 1`] = `[Function]`;

View file

@ -1,3 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`searchBar.tsx Tests SearchBar rendering 1`] = `[Function]`;
exports[`searchBar.tsx Tests SearchBar rendering with properties 1`] = `[Function]`;
exports[`searchBar.tsx Tests searchBar rendering without properties 1`] = `[Function]`;

View file

@ -98,7 +98,12 @@ it("getExtension test", () => {
expect(getExtension(31)).toEqual("st");
});
it("Greeter snapshot test", () => {
const { asFragment } = render(<Greeter data={props} />);
it("Greeter snapshot test with properties", () => {
const { asFragment } = render(<Greeter greeter={{ greeter: props }} />);
expect(asFragment).toMatchSnapshot();
});
it("Greeter snapshot test without properties", () => {
const { asFragment } = render(<Greeter />);
expect(asFragment).toMatchSnapshot();
});

View file

@ -54,11 +54,16 @@ describe("searchBar.tsx", () => {
};
});
it("Tests SearchBar rendering", () => {
it("Tests SearchBar rendering with properties", () => {
const { asFragment } = render(<SearchBar search={props} />);
expect(asFragment).toMatchSnapshot();
});
it("Tests searchBar rendering without properties", () => {
const { asFragment } = render(<SearchBar />);
expect(asFragment).toMatchSnapshot();
});
it("Tests handleQueryWithProvider", () => {
props.providers?.forEach((provider: ISearchProviderProps) => {
handleQueryWithProvider(props, provider.prefix + " test");

View file

@ -9,24 +9,26 @@ import Settings, {
SectionHeadline,
} from "../../components/settings";
import { ISearchProps } from "../../components/searchBar";
import { IThemeProps } from "../../lib/useTheme";
import { IThemeDataProps } from "../../lib/useTheme";
const themes: Array<IThemeProps> = [
{
label: "Classic",
value: 0,
mainColor: "#000000",
accentColor: "#1e272e",
backgroundColor: "#ffffff",
},
{
label: "Classic",
value: 1,
mainColor: "#000000",
accentColor: "#1e272e",
backgroundColor: "#ffffff",
},
];
const themes: IThemeDataProps = {
themes: [
{
label: "Classic",
value: 0,
mainColor: "#000000",
accentColor: "#1e272e",
backgroundColor: "#ffffff",
},
{
label: "Classic",
value: 1,
mainColor: "#000000",
accentColor: "#1e272e",
backgroundColor: "#ffffff",
},
],
};
const search: ISearchProps = {
defaultProvider: "https://test.com?q=",