github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/src/views/statements/statementsPage.spec.tsx (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  import React from "react";
    12  import { assert } from "chai";
    13  import { ReactWrapper } from "enzyme";
    14  
    15  import { connectedMount } from "src/test-utils";
    16  import StatementsPageConnected, {
    17    StatementsPage,
    18    StatementsPageProps,
    19    StatementsPageState,
    20  } from "src/views/statements/statementsPage";
    21  
    22  describe("StatementsPage", () => {
    23    describe("Statements table", () => {
    24      it("sorts data by Execution Count DESC as default option", () => {
    25        const rootWrapper = connectedMount(() => <StatementsPageConnected />);
    26  
    27        const statementsPageWrapper: ReactWrapper<StatementsPageProps, StatementsPageState> = rootWrapper.find(StatementsPage).first();
    28        const statementsPageInstance = statementsPageWrapper.instance();
    29  
    30        assert.equal(statementsPageInstance.state.sortSetting.sortKey, 3);
    31        assert.equal(statementsPageInstance.state.sortSetting.ascending, false);
    32      });
    33    });
    34  });