Unit Test for QueryEditor

Hi All,
I am being assigned to perform a unit test on the QueryEditor.I want some tips on how to proceed with testing using JEST and ENZYME.I also wanted to know how should I mock the Props type in the .test.tsx file.
The Code Snippet is

            import React, { PureComponent, ChangeEvent } from "react";
            import { FormField, Button, Select, FormLabel } from "@grafana/ui";
            import { QueryEditorProps} from "@grafana/data";
            import { DataSource } from "./DataSource";
            import { Query, DataSourceOptions } from "./types";
            import { getAggregateOptions } from "./components/mockAggregateOptions";

            export type Props = QueryEditorProps<DataSource, Query, DataSourceOptions>;

            export class QueryEditor extends PureComponent<Props> {......}

and the DataSource files i.e ./DataSource contains

import {
} from “@grafana/data”;
import { getBackendSrv } from “@grafana/runtime”;
import { Query, DataSourceOptions } from “./types”;

export class DataSource extends DataSourceApi<Query, DataSourceOptions> {…}

1 Like