grafana/public/app/plugins/panel/geomap/style/utils.test.ts
renovate[bot] e84a01e870
Update jest monorepo to v29 (#58261)
* Update jest monorepo to v29

* update snapshots + wrap test in act

* fix linting errors: jest.mocked now defaults to deep mocking

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2022-11-24 14:00:41 +00:00

56 lines
1.3 KiB
TypeScript

import { ResourceDimensionMode } from 'app/features/dimensions';
import { StyleConfig } from './types';
import { getStyleConfigState } from './utils';
describe('style utils', () => {
it('should fill in default values', async () => {
const cfg: StyleConfig = {
color: {
field: 'Price',
fixed: 'dark-green',
},
opacity: 0.4,
size: {
field: 'Count',
fixed: 5,
max: 15,
min: 2,
},
symbol: {
fixed: 'img/icons/marker/star.svg',
mode: ResourceDimensionMode.Fixed, // 'fixed',
},
textConfig: {
fontSize: 12,
offsetX: 0,
offsetY: 0,
// textAlign: 'center',
// textBaseline: 'middle',
},
};
const state = await getStyleConfigState(cfg);
state.config = null as unknown as StyleConfig; // not interesting in the snapshot
expect(state.hasText).toBe(false);
expect(state).toMatchInlineSnapshot(`
{
"base": {
"color": "#37872D",
"lineWidth": 1,
"opacity": 0.4,
"rotation": 0,
"size": 5,
},
"config": null,
"fields": {
"color": "Price",
"size": "Count",
},
"hasText": false,
"maker": [Function],
}
`);
});
});