UNPKG

maplibre-gl

Version:

BSD licensed community fork of mapbox-gl, a WebGL interactive maps library

17 lines (13 loc) • 502 B
import {describe, test, expect, vi} from 'vitest'; import {ThrottledInvoker} from './throttled_invoker.ts'; import {sleep} from './test/util.ts'; describe('ThrottledInvoker', () => { test('invokes the method when the message port is closed', async () => { const method = vi.fn(); const invoker = new ThrottledInvoker(method); invoker._channel.port1.close(); invoker.trigger(); await sleep(10); expect(method).toHaveBeenCalledTimes(1); }); });