Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enterprise Search] Misc test branch coverage #86847

Merged
merged 5 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@ export const buildSearchUIConfig = (apiConnector: object, schema: Schema) => {
sortField: 'id',
},
searchQuery: {
result_fields: Object.keys(schema || {}).reduce(
(acc: { [key: string]: object }, key: string) => {
acc[key] = {
snippet: {
size: 300,
fallback: true,
},
raw: {},
};
return acc;
},
{}
),
result_fields: Object.keys(schema).reduce((acc: { [key: string]: object }, key: string) => {
acc[key] = {
snippet: {
size: 300,
fallback: true,
},
raw: {},
};
return acc;
}, {}),
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,12 @@ export const determineTooltipContent = (
if (!logRetentionSettings.enabled) {
return renderOrReturnMessage(messages.noLogging);
}
if (logRetentionSettings.enabled && !ilmEnabled) {
if (!ilmEnabled) {
return renderOrReturnMessage(messages.ilmDisabled);
}
if (
logRetentionSettings.enabled &&
ilmEnabled &&
!logRetentionSettings.retentionPolicy?.isDefault
) {
if (!logRetentionSettings.retentionPolicy?.isDefault) {
return renderOrReturnMessage(messages.customPolicy);
}
if (
logRetentionSettings.enabled &&
ilmEnabled &&
logRetentionSettings.retentionPolicy?.isDefault
) {
} else {
return renderOrReturnMessage(messages.defaultPolicy);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ describe('SchemaAddFieldModal', () => {
expect(wrapper.find(EuiModal)).toHaveLength(1);
});

// No matter what I try I can't get this to actually achieve coverage.
it('sets loading state in useEffect', () => {
setState(true);
const wrapper = mount(<SchemaAddFieldModal {...props} {...errors} />);
const wrapper = mount(<SchemaAddFieldModal {...props} />);
wrapper.setProps({ ...errors });
const input = wrapper.find(EuiFieldText);

expect(input.prop('isLoading')).toEqual(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ describe('SourceIcon', () => {

expect(wrapper.find('.wrapped-icon')).toHaveLength(1);
});

it('renders a full bleed icon', () => {
const wrapper = shallow(<SourceIcon name="foo" fullBleed serviceType="custom" />);

expect(wrapper.find(EuiIcon).prop('type')).toEqual('test-file-stub');
});
});