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

import { SiteName } from './SiteName';

describe('SiteName component', () => {
  const site = {
    getSchema: jest.fn().mockReturnValue({ name: 'test name' }),
  };

  let wrapper;

  beforeEach(() => {
    site.getSchema.mockClear();
    wrapper = shallow(<SiteName site={ site } />);
  });

  it('renders', () => {
    expect(wrapper).toBeDefined();
  });

  it('retrieves the schema from the site', () => {
    expect(site.getSchema).toHaveBeenCalled();
  });

  it('renders the site name', () => {
    expect(wrapper.text()).toBe('test name');
  });
});
