diff options
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/testUtils.ts')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/testUtils.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/testUtils.ts b/server/sonar-web/src/main/js/helpers/testUtils.ts index fdf8bf0728b..210bd412192 100644 --- a/server/sonar-web/src/main/js/helpers/testUtils.ts +++ b/server/sonar-web/src/main/js/helpers/testUtils.ts @@ -19,6 +19,7 @@ */ import { ShallowWrapper, ReactWrapper } from 'enzyme'; import { InjectedRouter } from 'react-router'; +import { Location } from 'history'; import { EditionKey } from '../apps/marketplace/utils'; export const mockEvent = { @@ -133,6 +134,18 @@ export async function waitAndUpdate(wrapper: ShallowWrapper<any, any> | ReactWra wrapper.update(); } +export function mockLocation(overrides = {}): Location { + return { + action: 'PUSH', + key: 'key', + pathname: '/path', + query: {}, + search: '', + state: {}, + ...overrides + }; +} + export function mockRouter(overrides: { push?: Function; replace?: Function } = {}) { return { createHref: jest.fn(), |