1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00
unleash.unleash/frontend/src/component/api/__tests__/show-api-details-component-test.jsx
ivaosthu c4900262f2 feat: Customisable UI via config
This feature enables overrides of certain UI elements from the API
such as setting a different background color for the header.

This will make it easier to customise the UI in different environemnt.
2019-03-13 08:49:50 +01:00

33 lines
995 B
JavaScript

import React from 'react';
import ShowApiDetailsComponent from '../show-api-details-component';
import renderer from 'react-test-renderer';
jest.mock('react-mdl');
const uiConfig = {
slogan: 'We are the best!',
environment: 'test',
};
test('renders correctly with empty api details', () => {
const tree = renderer
.create(<ShowApiDetailsComponent fetchAll={jest.fn()} apiDetails={{}} uiConfig={uiConfig} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
test('renders correctly with details', () => {
const tree = renderer
.create(<ShowApiDetailsComponent fetchAll={jest.fn()} apiDetails={{ version: '1.1.0' }} uiConfig={uiConfig} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
test('renders correctly without uiConfig', () => {
const tree = renderer
.create(<ShowApiDetailsComponent fetchAll={jest.fn()} apiDetails={{ version: '1.1.0' }} uiConfig={{}} />)
.toJSON();
expect(tree).toMatchSnapshot();
});