Skip to content

Commit

Permalink
EDSC-4349 Fixing test
Browse files Browse the repository at this point in the history
  • Loading branch information
dpesall committed Jan 8, 2025
1 parent 8965e61 commit 1c9e227
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ describe('SpatialSelectionDropdown component', () => {
await user.click(dropdownSelectionButton)
})

expect(screen.getByRole('button', { name: 'Select Polygon' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Select Rectangle' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Select Point' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Select Circle' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Select Shapefile' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Polygon' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Rectangle' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Point' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Circle' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'File (KML, KMZ, ESRI, …)' })).toBeInTheDocument()
})

test('clicking the polygon dropdown emits an event and tracks metric', async () => {
Expand All @@ -59,7 +59,7 @@ describe('SpatialSelectionDropdown component', () => {
await user.click(dropdownSelectionButton)
})

await user.click(screen.getByRole('button', { name: 'Select Polygon' }))
await user.click(screen.getByRole('button', { name: 'Polygon' }))

expect(eventEmitterEmitMock).toHaveBeenCalledTimes(1)
expect(eventEmitterEmitMock).toHaveBeenCalledWith('map.drawStart', { type: 'polygon' })
Expand All @@ -80,7 +80,7 @@ describe('SpatialSelectionDropdown component', () => {
await user.click(dropdownSelectionButton)
})

await user.click(screen.getByRole('button', { name: 'Select Rectangle' }))
await user.click(screen.getByRole('button', { name: 'Rectangle' }))

expect(eventEmitterEmitMock).toHaveBeenCalledTimes(1)
expect(eventEmitterEmitMock).toHaveBeenCalledWith('map.drawStart', { type: 'rectangle' })
Expand All @@ -101,7 +101,7 @@ describe('SpatialSelectionDropdown component', () => {
await user.click(dropdownSelectionButton)
})

await user.click(screen.getByRole('button', { name: 'Select Point' }))
await user.click(screen.getByRole('button', { name: 'Point' }))

expect(eventEmitterEmitMock).toHaveBeenCalledTimes(1)
expect(eventEmitterEmitMock).toHaveBeenCalledWith('map.drawStart', { type: 'marker' })
Expand All @@ -122,7 +122,7 @@ describe('SpatialSelectionDropdown component', () => {
await user.click(dropdownSelectionButton)
})

await user.click(screen.getByRole('button', { name: 'Select Circle' }))
await user.click(screen.getByRole('button', { name: 'Circle' }))

expect(eventEmitterEmitMock).toHaveBeenCalledTimes(1)
expect(eventEmitterEmitMock).toHaveBeenCalledWith('map.drawStart', { type: 'circle' })
Expand All @@ -141,7 +141,7 @@ describe('SpatialSelectionDropdown component', () => {
await user.click(dropdownSelectionButton)
})

await user.click(screen.getByRole('button', { name: 'Select Shapefile' }))
await user.click(screen.getByRole('button', { name: 'File (KML, KMZ, ESRI, …)' }))

expect(onToggleShapefileUploadModal).toHaveBeenCalledTimes(1)
expect(onToggleShapefileUploadModal).toHaveBeenCalledWith(true)
Expand All @@ -166,7 +166,7 @@ describe('SpatialSelectionDropdown component', () => {
await user.click(dropdownSelectionButton)
})

const shapeFileSelectionButton = screen.getByRole('button', { name: 'Select Shapefile' })
const shapeFileSelectionButton = screen.getByRole('button', { name: 'File (KML, KMZ, ESRI, …)' })
await user.click(shapeFileSelectionButton)

expect(shapeFileSelectionButton).toBeDisabled()
Expand Down

0 comments on commit 1c9e227

Please sign in to comment.