{"size": 1447, "ext": "js", "max_stars_repo_path": "frontend/src/reducers/__tests__/order/orderCreateReducer.test.js", "max_stars_repo_name": "matias-rivera/restobar", "max_stars_repo_stars_event_min_datetime": "2021-06-20T22:15:58.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T16:20:16.000Z", "max_issues_repo_path": "frontend/src/reducers/__tests__/order/orderCreateReducer.test.js", "max_issues_repo_name": "matias-rivera/restobar", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "frontend/src/reducers/__tests__/order/orderCreateReducer.test.js", "max_forks_repo_name": "matias-rivera/restobar", "max_forks_repo_forks_event_min_datetime": "2021-03-31T11:47:46.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-14T13:21:39.000Z"}
{"max_stars_count": 9, "max_issues_count": null, "max_forks_count": 8, "avg_line_length": 23.3387096774, "max_line_length": 64, "alphanum_fraction": 0.6268140981}
import {
    ORDER_CREATE_FAIL,
    ORDER_CREATE_REQUEST,
    ORDER_CREATE_SUCCESS,
    ORDER_CREATE_RESET,
} from "../../../constants/orderConstants";
import { orderCreateReducer } from "../../orderReducers";

it("handles actions of type ORDER_CREATE_REQUEST", () => {
    const action = {
        type: ORDER_CREATE_REQUEST,
    };

    const newState = orderCreateReducer({}, action);

    expect(newState).toEqual({ loading: true });
});

it("handles actions of type ORDER_CREATE_SUCCESS", () => {
    const action = {
        type: ORDER_CREATE_SUCCESS,
    };

    const newState = orderCreateReducer({}, action);

    expect(newState).toEqual({ loading: false, success: true });
});

it("handles actions of type ORDER_CREATE_FAIL", () => {
    const action = {
        type: ORDER_CREATE_FAIL,
        payload: "Request failed with status code 500",
    };

    const newState = orderCreateReducer({}, action);

    expect(newState).toEqual({
        loading: false,
        error: "Request failed with status code 500",
    });
});

it("handles actions of type ORDER_CREATE_RESET", () => {
    const action = {
        type: ORDER_CREATE_RESET,
    };

    const newState = orderCreateReducer({}, action);

    expect(newState).toEqual({});
});

it("handles action with unknown type", () => {
    const action = {
        type: "UNKNOWN",
    };

    const newState = orderCreateReducer({}, action);

    expect(newState).toEqual({});
});
