Skip to content

Commit 77533da

Browse files
authored
[App Search] 100% code coverage plus fix console error (#101407)
1 parent 9a275de commit 77533da

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

x-pack/plugins/enterprise_search/public/applications/__mocks__/flash_messages_logic.mock.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const mockFlashMessagesActions = {
1515
clearFlashMessages: jest.fn(),
1616
setQueuedMessages: jest.fn(),
1717
clearQueuedMessages: jest.fn(),
18+
dismissToastMessage: jest.fn(),
1819
};
1920

2021
export const mockFlashMessageHelpers = {

x-pack/plugins/enterprise_search/public/applications/app_search/components/library/library.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* 2.0.
66
*/
77

8+
/* istanbul ignore file */
9+
810
import React, { useState } from 'react';
911

1012
import {

x-pack/plugins/enterprise_search/public/applications/app_search/index.test.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { EngineRouter, EngineNav } from './components/engine';
2626
import { EngineCreation } from './components/engine_creation';
2727
import { EnginesOverview } from './components/engines';
2828
import { ErrorConnecting } from './components/error_connecting';
29+
import { Library } from './components/library';
2930
import { MetaEngineCreation } from './components/meta_engine_creation';
3031
import { RoleMappingsRouter } from './components/role_mappings';
3132
import { SetupGuide } from './components/setup_guide';
@@ -147,6 +148,28 @@ describe('AppSearchConfigured', () => {
147148
});
148149
});
149150
});
151+
152+
describe('library', () => {
153+
it('renders a library page in development', () => {
154+
const OLD_ENV = process.env.NODE_ENV;
155+
process.env.NODE_ENV = 'development';
156+
157+
rerender(wrapper);
158+
159+
expect(wrapper.find(Library)).toHaveLength(1);
160+
process.env.NODE_ENV = OLD_ENV;
161+
});
162+
163+
it("doesn't in production", () => {
164+
const OLD_ENV = process.env.NODE_ENV;
165+
process.env.NODE_ENV = 'production';
166+
167+
rerender(wrapper);
168+
169+
expect(wrapper.find(Library)).toHaveLength(0);
170+
process.env.NODE_ENV = OLD_ENV;
171+
});
172+
});
150173
});
151174

152175
describe('AppSearchNav', () => {

0 commit comments

Comments
 (0)