Skip to content

Commit

Permalink
Fix failing tests and add key
Browse files Browse the repository at this point in the history
  • Loading branch information
scottybollinger committed Sep 28, 2021
1 parent 51f844f commit 07a68fa
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const fullContentSources = [
groups,
custom: false,
isIndexedSource: true,
isSyncConfigEnabled: true,
areThumbnailsConfigEnabled: true,
accessToken: '123token',
urlField: 'myLink',
Expand All @@ -131,6 +132,7 @@ export const fullContentSources = [
indexing: defaultIndexing,
custom: true,
isIndexedSource: true,
isSyncConfigEnabled: true,
areThumbnailsConfigEnabled: true,
accessToken: '123token',
urlField: 'url',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('useSourceSubNav', () => {
it('returns extra nav items for synchronization', () => {
setMockValues({
isOrganization: true,
contentSource: { id: '2', isIndexedSource: true, name: 'foo' },
contentSource: { id: '2', isIndexedSource: true, name: 'foo', isSyncConfigEnabled: true },
});

expect(useSourceSubNav()).toEqual([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const BlockedWindows: React.FC = () => {

const blockedWindowItems = (
<>
{blockedWindows.map((blockedWindow) => (
<BlockedWindowItem blockedWindow={blockedWindow} />
{blockedWindows.map((blockedWindow, i) => (
<BlockedWindowItem key={i} blockedWindow={blockedWindow} />
))}
<EuiSpacer />
<EuiButton onClick={addBlockedWindow}>{ADD_LABEL}</EuiButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,29 @@
* 2.0.
*/

import { setMockValues } from '../../../../../__mocks__/kea_logic';

import React from 'react';

import { shallow } from 'enzyme';

import { EuiLink, EuiSwitch } from '@elastic/eui';
import { EuiLink, EuiCallOut, EuiSwitch } from '@elastic/eui';

import { Synchronization } from './synchronization';

describe('Synchronization', () => {
it('renders', () => {
it('renders when config enabled', () => {
setMockValues({ contentSource: { isSyncConfigEnabled: true } });
const wrapper = shallow(<Synchronization />);

expect(wrapper.find(EuiLink)).toHaveLength(1);
expect(wrapper.find(EuiSwitch)).toHaveLength(1);
});

it('renders when config disabled', () => {
setMockValues({ contentSource: { isSyncConfigEnabled: false } });
const wrapper = shallow(<Synchronization />);

expect(wrapper.find(EuiCallOut)).toHaveLength(1);
});
});

0 comments on commit 07a68fa

Please sign in to comment.