import getDomMarkerIcon, { DomIcons } from '../../src/utils/get-dom-marker-icon' describe('', () => { describe('#getDomMarkerIcon(html: string): H.map.DomIcon', () => { beforeEach(() => { DomIcons.clear() }) it('should create a new dom icon instance if one does not exist', () => { const html: string = '
' // test we get an icon instance const icon: H.map.DomIcon = getDomMarkerIcon(html) expect(icon).toBeInstanceOf(H.map.DomIcon) }) it('should add the new dom icon instance to the map', () => { const html: string = '
' // expect the map size to be zero expect(DomIcons.size).toEqual(0) // get an icon instance getDomMarkerIcon(html) // test that the size has increased by one expect(DomIcons.size).toEqual(1) }) it('shouldn\'t create two dom icons for the same bitmap', () => { const html: string = '
' // get an icon instance getDomMarkerIcon(html) // test that the size has increased to one expect(DomIcons.size).toEqual(1) // get a second icon instance getDomMarkerIcon(html) // test that the size is still one expect(DomIcons.size).toEqual(1) }) }) })