jest.dontMock('../CollapsingString');
jest.dontMock('../PageHeader');
jest.dontMock('../ServiceInfo');

/* eslint-disable no-unused-vars */
const React = require('react');
/* eslint-enable no-unused-vars */
const ReactDOM = require('react-dom');

const Service = require('../../structs/Service');
const ServiceInfo = require('../ServiceInfo');

describe('ServiceInfo', function () {

  const service = new Service({
    id: '/group/test',
    healthChecks: [{path: '', protocol: 'HTTP'}],
    cpus: 1,
    deployments: [],
    mem: 2048,
    disk: 0,
    tasksStaged: 0,
    tasksRunning: 2,
    tasksHealthy: 2,
    tasksUnhealthy: 0,
    images: {
      'icon-large': 'foo.png'
    }
  });

  describe('#render', function () {
    beforeEach(function () {
      this.container = document.createElement('div');
      this.instance = ReactDOM.render(
        <ServiceInfo service={service} />,
        this.container
      );
      this.node = ReactDOM.findDOMNode(this.instance);
    });

    afterEach(function () {
      ReactDOM.unmountComponentAtNode(this.container);
    });

    it('renders name', function () {
      expect(this.node.querySelector('.h1 .collapsing-string-full-string').textContent).toEqual('test');
    });

    it('renders image', function () {
      expect(
        this.node.querySelector('.icon img').src
      ).toEqual('foo.png');
    });

    it('renders app status, not health state', function () {
      expect(
        this.node.querySelector('.page-header-sub-heading').children[0].children[0].textContent
      ).toEqual('Running');
    });

    it('renders number of running tasks', function () {
      expect(
        this.node.querySelector('.page-header-sub-heading').children[0].children[1].textContent
      ).toEqual('2 Tasks');
    });

  });
});

jest.dontMock('../CollapsingString');
jest.dontMock('../PageHeader');
jest.dontMock('../ServiceInfo');

/* eslint-disable no-unused-vars */
const React = require('react');
/* eslint-enable no-unused-vars */
const ReactDOM = require('react-dom');

const Service = require('../../structs/Service');
const ServiceInfo = require('../ServiceInfo');

describe('ServiceInfo', function () {

  const service = new Service({
    id: '/group/test',
    healthChecks: [{path: '', protocol: 'HTTP'}],
    cpus: 1,
    deployments: [],
    mem: 2048,
    disk: 0,
    tasksStaged: 0,
    tasksRunning: 2,
    tasksHealthy: 2,
    tasksUnhealthy: 0,
    labels: {
      'DCOS_PACKAGE_METADATA': 'eyJpbWFnZXMiOiB7ICJpY29uLXNtYWxsIjogImZvby1zbWFsbC5wbmciLCAiaWNvbi1tZWRpdW0iOiAiZm9vLW1lZGl1bS5wbmciLCAiaWNvbi1sYXJnZSI6ICJmb28tbGFyZ2UucG5nIn19'
    }
  });

  describe('#render', function () {
    beforeEach(function () {
      this.container = document.createElement('div');
      this.instance = ReactDOM.render(
        <ServiceInfo service={service} />,
        this.container
      );
      this.node = ReactDOM.findDOMNode(this.instance);
    });

    afterEach(function () {
      ReactDOM.unmountComponentAtNode(this.container);
    });

    it('renders name', function () {
      expect(this.node.querySelector('.h1 .collapsing-string-full-string').textContent).toEqual('test');
    });

    it('renders image', function () {
      expect(
        this.node.querySelector('.icon img').src
      ).toEqual('foo-large.png');
    });

    it('renders app status, not health state', function () {
      expect(
        this.node.querySelector('.page-header-sub-heading').children[0].children[0].textContent
      ).toEqual('Running');
    });

    it('renders number of running tasks', function () {
      expect(
        this.node.querySelector('.page-header-sub-heading').children[0].children[1].textContent
      ).toEqual('2 Tasks');
    });

  });
});

Fix service image tests