-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '7.x' into backport/7.x/pr-78988
- Loading branch information
Showing
19 changed files
with
251 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { addLayer } from './layer_actions'; | ||
import { LayerDescriptor } from '../../common/descriptor_types'; | ||
import { LICENSED_FEATURES } from '../licensed_features'; | ||
|
||
const getStoreMock = jest.fn(); | ||
const dispatchMock = jest.fn(); | ||
|
||
describe('layer_actions', () => { | ||
afterEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
describe('addLayer', () => { | ||
const notifyLicensedFeatureUsageMock = jest.fn(); | ||
|
||
beforeEach(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('../licensed_features').notifyLicensedFeatureUsage = (feature: LICENSED_FEATURES) => { | ||
notifyLicensedFeatureUsageMock(feature); | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('../selectors/map_selectors').getMapReady = () => { | ||
return true; | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('../selectors/map_selectors').createLayerInstance = () => { | ||
return { | ||
getLicensedFeatures() { | ||
return [LICENSED_FEATURES.GEO_SHAPE_AGGS_GEO_TILE]; | ||
}, | ||
}; | ||
}; | ||
}); | ||
|
||
it('should register feature-use', async () => { | ||
const action = addLayer(({} as unknown) as LayerDescriptor); | ||
await action(dispatchMock, getStoreMock); | ||
expect(notifyLicensedFeatureUsageMock).toHaveBeenCalledWith( | ||
LICENSED_FEATURES.GEO_SHAPE_AGGS_GEO_TILE | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.