diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx index 72ae8fc9b..45cb842fb 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx @@ -383,8 +383,8 @@ describe("Documents tab (noSql API)", () => { wrapper.unmount(); }); - it("should render the Edit Filter button", () => { - expect(wrapper.findWhere((node) => node.text() === "Edit Filter").exists()).toBeTruthy(); + it("should render the page", () => { + expect(wrapper).toMatchSnapshot(); }); it("clicking on Edit filter should render the Apply Filter button", () => { diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTableComponent.test.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTableComponent.test.tsx index 74e9f1500..e20084648 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTableComponent.test.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTableComponent.test.tsx @@ -1,5 +1,5 @@ import { TableRowId } from "@fluentui/react-components"; -import { ReactWrapper, mount } from "enzyme"; +import { mount } from "enzyme"; import React from "react"; import { DocumentsTableComponent, IDocumentsTableComponentProps } from "./DocumentsTableComponent"; @@ -26,47 +26,9 @@ describe("DocumentsTableComponent", () => { }, }); - describe("when rendered", () => { - let wrapper: ReactWrapper; - beforeEach(() => { - const props: IDocumentsTableComponentProps = createMockProps(); - wrapper = mount(); - }); - - afterEach(() => { - wrapper.unmount(); - }); - - it("should show id and partition key(s) in header", () => { - expect( - wrapper - .find(".fui-TableHeader") - .findWhere((node) => node.text() === ID_HEADER) - .exists(), - ).toBeTruthy(); - expect( - wrapper - .find(".fui-TableHeader") - .findWhere((node) => node.text() === PARTITION_KEY_HEADER) - .exists(), - ).toBeTruthy(); - }); - - it("should show documents", () => { - const rows = wrapper.find(".fui-TableBody .fui-TableRow"); - expect(rows.length).toBe(3); - expect( - rows - .at(1) - .findWhere((node) => node.text() === "2") - .exists(), - ).toBeTruthy(); - expect( - rows - .at(1) - .findWhere((node) => node.text() === "pk2") - .exists(), - ).toBeTruthy(); - }); + it("should render documents and partition keys in header", () => { + const props: IDocumentsTableComponentProps = createMockProps(); + const wrapper = mount(); + expect(wrapper).toMatchSnapshot(); }); }); diff --git a/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTabV2.test.tsx.snap b/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTabV2.test.tsx.snap new file mode 100644 index 000000000..0b4c7578e --- /dev/null +++ b/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTabV2.test.tsx.snap @@ -0,0 +1,558 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Documents tab (noSql API) when rendered should render the page 1`] = ` + + + + + + SELECT * FROM c + + + + Edit Filter + + + + + + + } + onClick={[Function]} + onKeyDown={[Function]} + size="small" + style={ + Object { + "backgroundColor": "white", + "color": undefined, + "float": "right", + "position": "absolute", + "right": 0, + "top": 6, + "zIndex": 1, + } + } + /> + + + + + + + + + +`; diff --git a/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTableComponent.test.tsx.snap b/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTableComponent.test.tsx.snap new file mode 100644 index 000000000..6e80eac9f --- /dev/null +++ b/src/Explorer/Tabs/DocumentsTabV2/__snapshots__/DocumentsTableComponent.test.tsx.snap @@ -0,0 +1,1140 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`DocumentsTableComponent should render documents and partition keys in header 1`] = ` + + + + + + + + + + + + + + + + + + + + + id + + + + + , + }, + } + } + > + + + } + className="documentsTableCell" + data-tabster="{\\"restorer\\":{\\"type\\":1}}" + id="menu3" + key="id" + onContextMenu={[Function]} + onMouseEnter={[Function]} + onMouseLeave={[Function]} + onMouseMove={[Function]} + style={ + Object { + "maxWidth": 50, + "minWidth": 50, + "width": 50, + } + } + > + + + id + + + + + + + + + + + + + + + + partitionKey + + + , + }, + } + } + > + + + + + + partitionKey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + pk1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + pk2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + + + + + + + + + + + + + pk3 + + + + + + + + + + + + + + + + + +`;