diff --git a/src/layers/__tests__/EarthEngine.spec.js b/src/layers/__tests__/EarthEngine.spec.js index be63a3b7..724fc187 100644 --- a/src/layers/__tests__/EarthEngine.spec.js +++ b/src/layers/__tests__/EarthEngine.spec.js @@ -4,13 +4,15 @@ 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', () => ({ - __esModule: true, - default: async () => async () => - new (class EarthEngineWorkerMock { - getTileUrl = async () => urlFormat - })(), -})) +jest.mock('../../earthengine/ee_worker_loader', () => { + class EarthEngineWorkerMock { + getTileUrl = async () => urlFormat + } + return { + __esModule: true, + default: async () => async () => EarthEngineWorkerMock, + } +}) const token = { access_token: 'abc', @@ -99,12 +101,22 @@ describe('EarthEngine', () => { expect(layer.getId()).not.toBeNull() }) - it('Should add to map', async () => { + it.only('Should add to map', async () => { + console.log('a') const layer = new EarthEngine(options) - await layer.addTo(mockMap) + console.log('b') + try { + console.log(layer) + await layer.addTo(mockMap) + } catch (error) { + console.log('IT WENT WRONG', error) + } + console.log('c') expect(layer.getMap()).toBe(mockMap) + console.log('d') expect(layer.getMapGL()).toBe(mockMapGL) + console.log('e') await expect(layer.options.getAuthToken()).resolves.toEqual(token) })