test('that the `fetch` hook returns a promise', () => {
    const type = string();
    const id = integer();
    const person = simpleObject();
    const dispatch = sinon.stub();
    const promise = simpleObject();
    duck.loadResource.withArgs(type, id).returns(person);
    dispatch.withArgs(person).returns(promise);

    assert.equal(ConnectedResource['@@redial-hooks'].fetch({params: {type, id}, dispatch}), promise);
  });
 const resources = listOf(() => ({...simpleObject(), id: integer(), displayName: string()}));
suite('person component test', () => {
  const person = {
    id: string(),
    displayName: word(),
    name: {
      first: word(),
      last: word()
    },
    avatar: {
      src: url(),
      size: integer()
    }
  };

  test('that the resource is displayed', () => {
    const data = {person};
    const $ = cheerio.load(reactDom.renderToStaticMarkup(<Person {...data} loading={false} />));
    const $avatar = $('div.resource img');

    assert.equal($('div.resource > h3').text(), data.person.displayName);
    assert.equal($avatar.attr('src'), data.person.avatar.src);
    assert.equal($avatar.attr('alt'), data.person.displayName);
    assert.equal($avatar.attr('height'), data.person.avatar.size);
    assert.equal($avatar.attr('width'), data.person.avatar.size);

    microformats.get({node: $}, (err, mformats) => {
      const hCard = mformats.items[0];
      assert.equal(hCard.properties.name, data.person.displayName);
      assert.equal(hCard.properties.photo, data.person.avatar.src);
      assert.equal(hCard.properties.nickname, data.person.id);
      assert.equal(hCard.properties['given-name'], data.person.name.first);
      assert.equal(hCard.properties['family-name'], data.person.name.last);
    });
  });

  test('that the page title is set', () => {
    const wrapper = shallow(<Person person={person} />);

    assert.equal(wrapper.find('HelmetWrapper').prop('title'), person.displayName);
  });

  test('that the loading indicator is shown when data is still loading', () => {
    const wrapper = shallow(<Person loading={true} />);

    assert.isTrue(
      wrapper.contains(<PageLoading />),
      'expected loading indicator to be displayed'
    );

    assert.isTrue(
      wrapper.contains(<Helmet title="Loading person..." />),
      'expected the title to be set to "Loading person..." using helmet'
    );
    assert.isFalse(
      wrapper.containsMatchingElement(<div className="resource" />),
      'expected the content to be hidden'
    );
  });
});