Skip to content

Commit

Permalink
[App Search] 100% code coverage plus fix console error (#101407)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonStoltz committed Jun 4, 2021
1 parent 9a275de commit 77533da
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const mockFlashMessagesActions = {
clearFlashMessages: jest.fn(),
setQueuedMessages: jest.fn(),
clearQueuedMessages: jest.fn(),
dismissToastMessage: jest.fn(),
};

export const mockFlashMessageHelpers = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* 2.0.
*/

/* istanbul ignore file */

import React, { useState } from 'react';

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { EngineRouter, EngineNav } from './components/engine';
import { EngineCreation } from './components/engine_creation';
import { EnginesOverview } from './components/engines';
import { ErrorConnecting } from './components/error_connecting';
import { Library } from './components/library';
import { MetaEngineCreation } from './components/meta_engine_creation';
import { RoleMappingsRouter } from './components/role_mappings';
import { SetupGuide } from './components/setup_guide';
Expand Down Expand Up @@ -147,6 +148,28 @@ describe('AppSearchConfigured', () => {
});
});
});

describe('library', () => {
it('renders a library page in development', () => {
const OLD_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'development';

rerender(wrapper);

expect(wrapper.find(Library)).toHaveLength(1);
process.env.NODE_ENV = OLD_ENV;
});

it("doesn't in production", () => {
const OLD_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'production';

rerender(wrapper);

expect(wrapper.find(Library)).toHaveLength(0);
process.env.NODE_ENV = OLD_ENV;
});
});
});

describe('AppSearchNav', () => {
Expand Down

0 comments on commit 77533da

Please sign in to comment.