import { assert, fixture, html } from '@open-wc/testing';
import sinon from 'sinon';
import { AmfEvents, AmfEventTypes } from  '../../../src/index.js';

describe('Events', () => {
  async function etFixture(): Promise<HTMLDivElement> {
    return fixture(html`<div></div>`);
  }

  describe('Store', () => {
    describe('error()', () => {
      it('dispatches the event', async () => {
        const et = await etFixture();
        const spy = sinon.spy();
        et.addEventListener(AmfEventTypes.Store.graphChange, spy);
        AmfEvents.Store.graphChange(et);
        assert.isTrue(spy.calledOnce);
      });
    });
  });
});
