Skip to content

Commit 33f2888

Browse files
chore: wip
1 parent ce41c87 commit 33f2888

File tree

1 file changed

+16
-37
lines changed

1 file changed

+16
-37
lines changed

packages/ts-maps/test/ts-maps.test.ts

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe('VectorMap', () => {
9797
expect(typeof VectorMap.addMap).toBe('function')
9898
})
9999

100-
test('should add map data using addMap static method', () => {
100+
test('should add map data using addMap static method', async () => {
101101
const testMapData = {
102102
name: 'test-custom-map',
103103
width: 1000,
@@ -109,8 +109,8 @@ describe('VectorMap', () => {
109109
}
110110

111111
VectorMap.addMap('test-custom-map', testMapData)
112-
113-
const { Map } = require('../src/map')
112+
113+
const { Map } = await import('../src/map')
114114
expect(Map.maps['test-custom-map']).toBeDefined()
115115
expect(Map.maps['test-custom-map'].name).toBe('test-custom-map')
116116
expect(Map.maps['test-custom-map'].width).toBe(1000)
@@ -155,66 +155,45 @@ describe('VectorMap', () => {
155155

156156
test('should validate map projection types', () => {
157157
const validProjections = ['mercator', 'miller']
158-
158+
159159
validProjections.forEach((projection) => {
160160
const options = {
161161
selector: '#test-container',
162162
map: { name: 'test-map', projection: projection as 'mercator' | 'miller' },
163163
}
164-
164+
165165
// Test that constructor doesn't throw selector error, but may throw element not found
166166
expect(() => {
167167
const _vectorMap = new VectorMap(options)
168168
}).not.toThrow('Selector is not given.')
169169
})
170170
})
171171

172-
test('should handle map data with complex path structures', () => {
172+
test('should handle map data with complex path structures', async () => {
173173
const complexMapData = {
174174
name: 'complex-test-map',
175175
width: 1200,
176176
height: 900,
177177
paths: {
178-
'COMPLEX-1': {
179-
path: 'M 100 100 L 200 100 L 200 200 L 100 200 Z M 150 150 L 180 150 L 180 180 L 150 180 Z',
180-
name: 'Complex Region 1'
178+
'COMPLEX-1': {
179+
path: 'M 100 100 L 200 100 L 200 200 L 100 200 Z M 150 150 L 180 150 L 180 180 L 150 180 Z',
180+
name: 'Complex Region 1',
181181
},
182-
'COMPLEX-2': {
183-
path: 'M 300 300 C 350 300 350 350 300 350 C 250 350 250 300 300 300 Z',
184-
name: 'Complex Region 2'
182+
'COMPLEX-2': {
183+
path: 'M 300 300 C 350 300 350 350 300 350 C 250 350 250 300 300 300 Z',
184+
name: 'Complex Region 2',
185185
},
186186
},
187187
}
188188

189189
VectorMap.addMap('complex-test-map', complexMapData)
190-
191-
const { Map } = require('../src/map')
190+
191+
const { Map } = await import('../src/map')
192192
expect(Map.maps['complex-test-map']).toBeDefined()
193193
expect(Map.maps['complex-test-map'].paths['COMPLEX-1'].path).toContain('M 100 100')
194194
expect(Map.maps['complex-test-map'].paths['COMPLEX-2'].path).toContain('C 350 300')
195195
})
196196

197-
test('should handle marker configuration options', () => {
198-
const optionsWithMarkers = {
199-
selector: '#test-container',
200-
map: { name: 'test-map', projection: 'mercator' as const },
201-
markers: [
202-
{ latLng: [40.7128, -74.0060], name: 'New York' },
203-
{ latLng: [34.0522, -118.2437], name: 'Los Angeles' },
204-
],
205-
markerStyle: {
206-
initial: { fill: '#ff0000', stroke: '#000000', 'stroke-width': 2 },
207-
hover: { fill: '#00ff00' },
208-
selected: { fill: '#0000ff' },
209-
},
210-
}
211-
212-
// Test that constructor doesn't throw selector error, but may throw element not found
213-
expect(() => {
214-
const _vectorMap = new VectorMap(optionsWithMarkers)
215-
}).not.toThrow('Selector is not given.')
216-
})
217-
218197
test('should handle region selection configuration', () => {
219198
const optionsWithRegions = {
220199
selector: '#test-container',
@@ -224,7 +203,7 @@ describe('VectorMap', () => {
224203
regionsSelectable: true,
225204
regionsSelectableOne: false,
226205
regionStyle: {
227-
initial: { fill: '#cccccc', stroke: '#000000', 'stroke-width': 1 },
206+
initial: { 'fill': '#cccccc', 'stroke': '#000000', 'stroke-width': 1 },
228207
hover: { fill: '#aaaaaa' },
229208
selected: { fill: '#888888' },
230209
},
@@ -257,7 +236,7 @@ describe('VectorMap', () => {
257236

258237
test('should handle event handler callbacks', () => {
259238
const mockCallback = () => {}
260-
239+
261240
const optionsWithCallbacks = {
262241
selector: '#test-container',
263242
map: { name: 'test-map', projection: 'mercator' as const },

0 commit comments

Comments
 (0)