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

describe('Test RCS actions', () => {
  test('uploadRcsAsset returns correct action', () => {
    const file = 'file';
    const assetType = 'IMAGE';
    const fileParams = { foo: 'bar' };
    const index = 2;
    const expected = {
      type: types.UPLOAD_RCS_ASSET_REQUEST,
      file,
      assetType,
      fileParams,
      index,
    };
    expect(actions.uploadRcsAsset(file, assetType, fileParams, index)).toStrictEqual(expected);
  });

  test('clearCreateResponse returns correct action', () => {
    expect(actions.clearCreateResponse()).toStrictEqual({ type: types.CLEAR_CREATE_RESPONSE_REQUEST });
  });

  test('createRcsTemplate returns correct action', () => {
    const template = { foo: 'bar' };
    const callback = jest.fn();
    expect(actions.createRcsTemplate(template, callback)).toStrictEqual({ type: types.CREATE_RCS_TEMPLATE_REQUEST, template, callback });
  });

  test('getTemplateDetails returns correct action', () => {
    const id = 'id123';
    const callback = jest.fn();
    expect(actions.getTemplateDetails(id, callback)).toStrictEqual({ type: types.GET_RCS_TEMPLATE_DETAILS_REQUEST, id, channel: types.RCS, callback });
  });

  test('editTemplate returns correct action', () => {
    const template = { foo: 'bar' };
    const callback = jest.fn();
    expect(actions.editTemplate(template, callback)).toStrictEqual({ type: types.EDIT_RCS_TEMPLATE_REQUEST, template, callback });
  });

  test('clearEditResponse returns correct action', () => {
    expect(actions.clearEditResponse()).toStrictEqual({ type: types.CLEAR_EDIT_RESPONSE_REQUEST });
  });
});
