Files
Josh Hunt 3c6e0e8ef8 Chore: ESlint import order (#44959)
* Add and configure eslint-plugin-import

* Fix the lint:ts npm command

* Autofix + prettier all the files

* Manually fix remaining files

* Move jquery code in jest-setup to external file to safely reorder imports

* Resolve issue caused by circular dependencies within Prometheus

* Update .betterer.results

* Fix missing // @ts-ignore

* ignore iconBundle.ts

* Fix missing // @ts-ignore
2022-04-22 14:33:13 +01: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 any; // not interesting in the snapshot
expect(state.hasText).toBe(false);
expect(state).toMatchInlineSnapshot(`
Object {
"base": Object {
"color": "#37872D",
"lineWidth": 1,
"opacity": 0.4,
"rotation": 0,
"size": 5,
},
"config": null,
"fields": Object {
"color": "Price",
"size": "Count",
},
"hasText": false,
"maker": [Function],
}
`);
});
});