Skip to content

Commit

Permalink
Done re-enabling component integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Dec 10, 2019
1 parent c6aef83 commit 6e90b77
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,35 @@ import {
} from '../../../../../../../src/core/public/mocks';
import { AppContextProvider } from '../../../public/np_ready/application/app_context';

export const mockContextValue = {
docLinks: docLinksServiceMock.createStartContract(),
chrome: chromeServiceMock.createStartContract(),
legacy: {
TimeBuckets: class MockTimeBuckes {
setBounds(_domain: any) {
return {};
}
getInterval() {
return {
expression: {},
};
}
},
MANAGEMENT_BREADCRUMB: { text: 'test' },
licenseStatus: {},
},
uiSettings: uiSettingsServiceMock.createSetupContract(),
toasts: notificationServiceMock.createSetupContract().toasts,
euiUtils: {
useChartsTheme: jest.fn(),
},
// For our test harness, we don't use this mocked out http service
http: httpServiceMock.createSetupContract(),
};

export const withAppContext = (Component: ComponentType<any>) => (props: any) => {
return (
<AppContextProvider
value={{
docLinks: docLinksServiceMock.createStartContract(),
chrome: chromeServiceMock.createStartContract(),
legacy: {
TimeBuckets: class MockTimeBuckes {
setBounds(_domain: any) {
return {};
}
getInterval() {
return {
expression: {},
};
}
},
MANAGEMENT_BREADCRUMB: { text: 'test' },
licenseStatus: {},
},
uiSettings: uiSettingsServiceMock.createSetupContract(),
toasts: notificationServiceMock.createSetupContract().toasts,
euiUtils: {
useChartsTheme: jest.fn(),
},
http: httpServiceMock.createSetupContract(),
}}
>
<AppContextProvider value={mockContextValue}>
<Component {...props} />
</AppContextProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const registerHttpRequestMockHelpers = (server: SinonFakeServer) => {
const defaultResponse = { watchHistoryItems: [] };
server.respondWith(
'GET',
`${API_ROOT}/watch/:id/history?startTime=*`,
`${API_ROOT}/watch/:id/history`,
mockResponse(defaultResponse, response)
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ mockHttpClient.interceptors.response.use(
res => {
return res.data;
},
rej => rej
rej => {
return Promise.reject(rej);
}
);

const mockSavedObjectsClient = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const watch = {
},
};

describe.skip('<WatchStatus />', () => {
describe('<WatchStatus />', () => {
const { server, httpRequestsMockHelpers } = setupEnvironment();
let testBed: WatchStatusTestBed;

Expand Down

0 comments on commit 6e90b77

Please sign in to comment.