import { getAllTemplates, setChannelAccount } from "../actions";
import * as types from "../constants";
import { RCS } from "../../CreativesContainer/constants";

describe("Test zalo list actions", () => {
  test.concurrent("has a type of GET_ALL_TEMPLATES_REQUEST action", () => {
    const channel = "Zalo";
    const queryParams = {
      page: 1,
      perPage: 25,
    };
    const expected = {
      type: types.GET_ALL_TEMPLATES_REQUEST,
      channel,
      intlCopyOf: "test",
      queryParams,
    };
    expect(getAllTemplates(channel, queryParams, "test")).toEqual(expected);
  });
});

describe("Test RCS list actions", () => {
  test.concurrent("has a type of GET_ALL_TEMPLATES_REQUEST action for RCS", () => {
    const channel = "Rcs";
    const queryParams = {
      page: 1,
      perPage: 25,
      accountId: "capillary_rcs",
      accessToken: "YugrOlhdSPpM",
      host: "rcsicsbulk",
    };
    const expected = {
      type: types.GET_ALL_TEMPLATES_REQUEST,
      channel,
      intlCopyOf: "test",
      queryParams,
    };
    expect(getAllTemplates(channel, queryParams, "test")).toEqual(expected);
  });

  test.concurrent("has a type of SET_RCS_ACCOUNT action", () => {
    const account = {
      sourceAccountIdentifier: "capillary_rcs",
      name: "RCS Account",
      configs: { accessToken: "YugrOlhdSPpM" },
      hostName: "rcsicsbulk",
    };
    const expected = {
      type: types.SET_RCS_ACCOUNT,
      account,
    };
    expect(setChannelAccount(RCS, account)).toEqual(expected);
  });
});
