1 | import * as React from 'react';
|
2 | import Source from '../source';
|
3 | import { mountWithMap, getMapMock } from '../jest/util';
|
4 |
|
5 | describe('Source', () => {
|
6 | const EMPTY_GEOJSON_SRC = {
|
7 | type: 'geojson',
|
8 | data: {
|
9 | type: 'FeatureCollection',
|
10 | features: []
|
11 | }
|
12 | };
|
13 |
|
14 | it('Should render source with geoJsonSource', () => {
|
15 | const mapMock = getMapMock({
|
16 | getSource: jest.fn()
|
17 | });
|
18 | const sourceId = 'source-1';
|
19 |
|
20 | mountWithMap(
|
21 | <Source id={sourceId} geoJsonSource={EMPTY_GEOJSON_SRC} />,
|
22 | mapMock
|
23 | );
|
24 |
|
25 | expect(mapMock.addSource.mock.calls[0]).toEqual([
|
26 | sourceId,
|
27 | {
|
28 | type: 'geojson',
|
29 | data: {
|
30 | type: 'FeatureCollection',
|
31 | features: []
|
32 | }
|
33 | }
|
34 | ]);
|
35 | });
|
36 | });
|