antv-l7/packages/source/__tests__/source.spec.ts

27 lines
671 B
TypeScript
Raw Normal View History

2020-09-09 20:06:53 +08:00
import { bBoxToBounds } from '@antv/l7-utils';
import Source from '../src/source';
2019-12-04 19:00:43 +08:00
import Point from './data/point';
import Polygon from './data/polygon';
describe('source constructor', () => {
it('source.constructor', () => {
const source = new Source(Polygon);
expect(source.extent).toEqual([
114.24373626708983,
30.55560910664438,
114.32424545288086,
30.60807236997211,
]);
});
2019-12-04 19:00:43 +08:00
it('source.cluster', () => {
const source = new Source(Point, {
cluster: true,
clusterOptions: {
method: 'sum',
field: 'mag',
},
});
source.updateClusterData(bBoxToBounds(source.extent), 2);
2019-12-04 19:00:43 +08:00
});
});