Skip to content

Commit

Permalink
Revert "fix: align mock implementation with getWorkerInstance"
Browse files Browse the repository at this point in the history
This reverts commit 2342d8a.
  • Loading branch information
HendrikThePendric committed Mar 4, 2024
1 parent 2342d8a commit 49b4cb3
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/layers/__tests__/EarthEngine.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ const urlFormat =
'https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/maps/.../tiles/{z}/{x}/{y}'

// Mock out EE Worker - import.meta not supported in jest
jest.mock('../../earthengine/ee_worker_loader', () => {
class EarthEngineWorkerMock {
getTileUrl = async () => urlFormat
}
return {
__esModule: true,
default: async () => async () => EarthEngineWorkerMock,
}
})
jest.mock('../../earthengine/ee_worker_loader', () => ({
__esModule: true,
default: async () => async () =>
new (class EarthEngineWorkerMock {
getTileUrl = async () => urlFormat
})(),
}))

const token = {
access_token: 'abc',
Expand Down Expand Up @@ -101,22 +99,12 @@ describe('EarthEngine', () => {
expect(layer.getId()).not.toBeNull()
})

it.only('Should add to map', async () => {
console.log('a')
it('Should add to map', async () => {
const layer = new EarthEngine(options)
console.log('b')
try {
console.log(layer)
await layer.addTo(mockMap)
} catch (error) {
console.log('IT WENT WRONG', error)
}
console.log('c')
await layer.addTo(mockMap)

expect(layer.getMap()).toBe(mockMap)
console.log('d')
expect(layer.getMapGL()).toBe(mockMapGL)
console.log('e')

await expect(layer.options.getAuthToken()).resolves.toEqual(token)
})
Expand Down

0 comments on commit 49b4cb3

Please sign in to comment.