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

describe('Test whatsapp actions', () => {
  test.concurrent('has a type of TEMPLATE_CREATE_REQUEST action', () => {
    const payload = {
      name: 'template_name',
      versions: {
        base: {
          content: {
            whatsapp: {
              category: 'TRANSACTIONAL',
              languages: [
                {
                  language: 'en',
                  content: 'gupshup template message',
                },
              ],
              mediaType: 'TEXT',
              varMapped: {},
              templateEditor: false,
              accountId: '2000222347',
              accessToken: 'DTpZEh4VK',
              hostName: 'gupshupwhatsappbulk',
              baseUrl: 'https://api.gupshup.io/whatsapp/v1',
            },
          },
        },
      },
      type: 'WHATSAPP',
    };
    const expected = {
      type: types.TEMPLATE_CREATE_REQUEST,
      payload,
      callback: undefined,
      gupshupMediaFile: undefined,
    };
    expect(
      actions.createWhatsappTemplate(payload, undefined, undefined),
    ).toStrictEqual(expected);
  });

  test.concurrent("test getMetaTags", () => {
    const payload = {
      previewUrl: 'https://capillarytech.com',
      callBack: undefined,
    };
    const expected = {
      type: types.URL_META_TAGS_REQUEST,
      previewUrl: 'https://capillarytech.com',
      callBack: undefined,
    };
    expect(actions.getMetaTags(payload)).toStrictEqual(expected);
  });

  test.concurrent("test resetMetaTags", () => {
    const expected = {
      type: types.URL_META_TAGS_RESET,
    };
    expect(actions.resetMetaTags()).toStrictEqual(expected);
  });
});

