kibana/x-pack/plugins/banners/public/get_banner_info.test.ts
Pierre Gayvallet 570dcc07b5
Implement custom global header banner (#87438)
* first draft

* update plugin list

* fix tsproject

* update bundle limits file

* remove unused start dep

* adapt imports

* POC of footer banner

* update styles, mostly

* plug banner to uiSettings

* adding some unit tests

* add tests on sort_fields

* cleanup sums in sass mixins

* some self review stuff

* update generated doc

* add tests for color field

* update chrome header test snapshots

* retrieve license info from the server

* switch from uiSettings to plugin config

* update plugin list description

* update default colors

* NIT

* add markdown support

* fix banner overlap in fullscreen mode

* change banner height to 32px

* change banner's font size to 14

* delete unused uiSettings
2021-02-11 10:12:24 +01:00

36 lines
1,023 B
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { httpServiceMock } from '../../../../src/core/public/mocks';
import { getBannerInfo } from './get_banner_info';
describe('getBannerInfo', () => {
let http: ReturnType<typeof httpServiceMock.createStartContract>;
beforeEach(() => {
http = httpServiceMock.createStartContract();
});
it('calls `http.get` with the correct parameters', async () => {
await getBannerInfo(http);
expect(http.get).toHaveBeenCalledTimes(1);
expect(http.get).toHaveBeenCalledWith('/api/banners/info');
});
it('returns the value from the service', async () => {
const expected = {
allowed: true,
};
http.get.mockResolvedValue(expected);
const response = await getBannerInfo(http);
expect(response).toEqual(expected);
});
});