swap column types use of shape for exact and fix warnings it found

This commit is contained in:
John Mitchell
2019-12-19 11:17:27 -05:00
parent 2c1648f9c9
commit 30b6e318cc
6 changed files with 12 additions and 13 deletions

View File

@@ -1,7 +1,6 @@
import React from 'react'; import React from 'react';
import { createMemoryHistory } from 'history'; import { createMemoryHistory } from 'history';
import { mountWithContexts } from '@testUtils/enzymeHelpers'; import { mountWithContexts } from '@testUtils/enzymeHelpers';
import { sleep } from '@testUtils/testUtils';
import ListHeader from './ListHeader'; import ListHeader from './ListHeader';
describe('ListHeader', () => { describe('ListHeader', () => {
@@ -21,7 +20,7 @@ describe('ListHeader', () => {
{ name: 'foo', key: 'foo', isDefault: true}, { name: 'foo', key: 'foo', isDefault: true},
]} ]}
sortColumns={[ sortColumns={[
{ name: 'foo', key: 'foo', isDefault: true}, { name: 'foo', key: 'foo'},
]} ]}
renderToolbar={renderToolbarFn} renderToolbar={renderToolbarFn}
/> />
@@ -42,7 +41,7 @@ describe('ListHeader', () => {
{ name: 'foo', key: 'foo', isDefault: true}, { name: 'foo', key: 'foo', isDefault: true},
]} ]}
sortColumns={[ sortColumns={[
{ name: 'foo', key: 'foo', isDefault: true}, { name: 'foo', key: 'foo'},
]} ]}
/>, />,
{ context: { router: { history } } } { context: { router: { history } } }

View File

@@ -3,7 +3,7 @@ import { mountWithContexts } from '@testUtils/enzymeHelpers';
import { getQSConfig } from '@util/qs'; import { getQSConfig } from '@util/qs';
import OptionsList from './OptionsList'; import OptionsList from './OptionsList';
const qsConfig = getQSConfig('test', {}); const qsConfig = getQSConfig('test', { order_by: 'foo' });
describe('<OptionsList />', () => { describe('<OptionsList />', () => {
it('should display list of options', () => { it('should display list of options', () => {
@@ -17,8 +17,8 @@ describe('<OptionsList />', () => {
value={[]} value={[]}
options={options} options={options}
optionCount={3} optionCount={3}
searchColumns={[]} searchColumns={[{name: 'Foo', key: 'foo', isDefault: true}]}
sortColumns={[]} sortColumns={[{ name: 'Foo', key: 'foo' }]}
qsConfig={qsConfig} qsConfig={qsConfig}
selectItem={() => {}} selectItem={() => {}}
deselectItem={() => {}} deselectItem={() => {}}
@@ -40,8 +40,8 @@ describe('<OptionsList />', () => {
value={[options[1]]} value={[options[1]]}
options={options} options={options}
optionCount={3} optionCount={3}
searchColumns={[]} searchColumns={[{name: 'Foo', key: 'foo', isDefault: true}]}
sortColumns={[]} sortColumns={[{ name: 'Foo', key: 'foo' }]}
qsConfig={qsConfig} qsConfig={qsConfig}
selectItem={() => {}} selectItem={() => {}}
deselectItem={() => {}} deselectItem={() => {}}

View File

@@ -181,7 +181,6 @@ class ResourceAccessList extends React.Component {
{ {
name: i18n._(t`Username`), name: i18n._(t`Username`),
key: 'username', key: 'username',
isDefault: true
}, },
{ {
name: i18n._(t`First Name`), name: i18n._(t`First Name`),

View File

@@ -186,7 +186,6 @@ function InventoryGroupsList({ i18n, location, match }) {
{ {
name: i18n._(t`Is root group`), name: i18n._(t`Is root group`),
key: 'parents__isnull', key: 'parents__isnull',
isDefault: true,
isBoolean: true isBoolean: true
}, },
{ {

View File

@@ -173,7 +173,6 @@ class UsersList extends Component {
{ {
name: i18n._(t`Username`), name: i18n._(t`Username`),
key: 'username', key: 'username',
isDefault: true
}, },
{ {
name: i18n._(t`First name`), name: i18n._(t`First name`),

View File

@@ -1,5 +1,6 @@
import { import {
shape, shape,
exact,
arrayOf, arrayOf,
number, number,
string, string,
@@ -251,15 +252,17 @@ export const Group = shape({
}); });
export const SearchColumns = arrayOf( export const SearchColumns = arrayOf(
shape({ exact({
name: string.isRequired, name: string.isRequired,
key: string.isRequired, key: string.isRequired,
isDefault: bool, isDefault: bool,
isBoolean: bool,
options: arrayOf(arrayOf(string, string))
}) })
); );
export const SortColumns = arrayOf( export const SortColumns = arrayOf(
shape({ exact({
name: string.isRequired, name: string.isRequired,
key: string.isRequired, key: string.isRequired,
}) })