{"size": 1870, "ext": "js", "max_stars_repo_path": "test/client/actions/index.js", "max_stars_repo_name": "mohayonao/virtual-launch-control", "max_stars_repo_stars_event_min_datetime": "2016-10-11T13:43:00.000Z", "max_stars_repo_stars_event_max_datetime": "2016-10-11T13:43:00.000Z", "max_issues_repo_path": "test/client/actions/index.js", "max_issues_repo_name": "mohayonao/virtual-launch-control", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/client/actions/index.js", "max_forks_repo_name": "mohayonao/virtual-launch-control", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 33.3928571429, "max_line_length": 77, "alphanum_fraction": 0.6561497326}
import "run-with-mocha";
import assert from "assert";
import * as actionCreators from "../../../src/client/actions";
import * as types from "../../../src/common/ActionTypes";

describe("actions", () => {
  it("setState should create SET_STATE action", () => {
    const actual = actionCreators.setState({ value: 100 });
    const expected = { type: types.SET_STATE, state: { value: 100 } };

    assert.deepEqual(actual, expected);
  });

  it("applyPatch should create APPLY_PATCH", () => {
    const actual = actionCreators.applyPatch([ { op: "add" } ]);
    const expected = { type: types.APPLY_PATCH, patch: [ { op: "add" } ] };

    assert.deepEqual(actual, expected);
  });

  it("valueChange should create VALUE_CHANGE", () => {
    const actual = actionCreators.valueChange(1, 2, 3);
    const expected = { type: types.VALUE_CHANGE, row: 1, col: 2, value: 3 };

    assert.deepEqual(actual, expected);
  });

  it("valueShift should create VALUE_SHIFT", () => {
    const actual = actionCreators.valueShift(1, 2, 3);
    const expected = { type: types.VALUE_SHIFT, row: 1, col: 2, value: 3 };

    assert.deepEqual(actual, expected);
  });

  it("cusorValueChange should create CURSOR_VALUE_CHANGE", () => {
    const actual = actionCreators.cusorValueChange(1, 2);
    const expected = { type: types.CURSOR_VALUE_CHANGE, index: 1, value: 2 };

    assert.deepEqual(actual, expected);
  });

  it("templateValueChange should create TEMPLATE_VALUE_CHANGE", () => {
    const actual = actionCreators.templateValueChange(1);
    const expected = { type: types.TEMPLATE_VALUE_CHANGE, value: 1 };

    assert.deepEqual(actual, expected);
  });

  it("selectKnob should create SELECT_KNOB", () => {
    const actual = actionCreators.selectKnob(1, 2);
    const expected = { type: types.SELECT_KNOB, row: 1, col: 2 };

    assert.deepEqual(actual, expected);
  });
});
