import {shallow} from 'enzyme';
import React from 'react';

import * as DummyWidget from 'src/main/components/DummyWidget';
import {UptimeService} from 'src/services/uptime';

describe('src/main/components/DummyWidget', () => {
  describe('DummyWidget', () => {
    it('renders the service information', () => {
      // Given
      const service = new UptimeService({instance: 'testing'});
      const component = shallow(
        <DummyWidget.DummyWidget service={service} />
      );

      // When
      const code = component.find('code').at(0);

      // Then
      expect(code.text()).toEqual(`${service.widget} (${service.instance})`);
    });
  });
});
