import * as actions from '../actions';
import * as types from '../constants';

describe('TestAndPreviewSlidebox actions', () => {
  it('should have a type of SEARCH_CUSTOMERS_REQUESTED', () => {
    const expected = {
      type: types.SEARCH_CUSTOMERS_REQUESTED,
      payload: { query: 'test' },
    };
    expect(actions.searchCustomersRequested('test')).toEqual(expected);
  });
  it('should have a type of EXTRACT_TAGS_REQUEST', () => {
    const expected = {
      type: types.EXTRACT_TAGS_REQUEST,
      payload: { templateSubject: 'test', templateContent: 'test' },
    };
    expect(actions.extractTagsRequested('test', 'test')).toEqual(expected);
  });
  it('should have a type of UPDATE_PREVIEW_REQUEST', () => {
    const expected = {
      type: types.UPDATE_PREVIEW_REQUEST,
      payload: 'test',
    };
    expect(actions.updatePreviewRequested('test')).toEqual(expected);
  });
  it('should have a type of SEND_TEST_MESSAGE_REQUESTED', () => {
    const expected = {
      type: types.SEND_TEST_MESSAGE_REQUESTED,
      payload: 'test',
      callback: undefined,
    };
    expect(actions.sendTestMessageRequested('test')).toEqual(expected);
  });
  it('should have a type of CLEAR_CUSTOMER_SEARCH_STATE', () => {
    const expected = {
      type: types.CLEAR_CUSTOMER_SEARCH_STATE,
    };
    expect(actions.clearCustomerSearchState()).toEqual(expected);
  });
  it('should have a type of CLEAR_SEARCH_RESULTS', () => {
    const expected = {
      type: types.CLEAR_SEARCH_RESULTS,
    };
    expect(actions.clearSearchResults()).toEqual(expected);
  });
  it('should have a type of FETCH_TEST_CUSTOMERS_REQUESTED', () => {
    const expected = {
      type: types.FETCH_TEST_CUSTOMERS_REQUESTED,
    };
    expect(actions.fetchTestCustomersRequested()).toEqual(expected);
  });
  it('should have a type of FETCH_TEST_GROUPS_REQUESTED', () => {
    const expected = {
      type: types.FETCH_TEST_GROUPS_REQUESTED,
    };
    expect(actions.fetchTestGroupsRequested()).toEqual(expected);
  });
  it('should have a type of CREATE_MESSAGE_META_REQUESTED', () => {
    const expected = {
      type: types.CREATE_MESSAGE_META_REQUESTED,
      payload: 'test',
      messageMetaConfigId: 'test',
      callback: undefined,
    };
    expect(actions.createMessageMetaRequested('test', 'test')).toEqual(expected);
  });
  it('should have a type of GET_PREFILLED_VALUES_REQUESTED', () => {
    const expected = {
      type: types.GET_PREFILLED_VALUES_REQUESTED,
      payload: 'test',
    };
    expect(actions.getPrefilledValuesRequested('test')).toEqual(expected);
  });
  it('should have a type of CLEAR_PREFILLED_VALUES', () => {
    const expected = {
      type: types.CLEAR_PREFILLED_VALUES,
    };
    expect(actions.clearPrefilledValues()).toEqual(expected);
  });
});
