{"size": 701, "ext": "js", "max_stars_repo_path": "src/lib/__tests__/createTransition_spec.js", "max_stars_repo_name": "renchap/react-dnd-multi-backend", "max_stars_repo_stars_event_min_datetime": "2018-10-05T17:18:25.000Z", "max_stars_repo_stars_event_max_datetime": "2018-10-05T17:18:25.000Z", "max_issues_repo_path": "src/lib/__tests__/createTransition_spec.js", "max_issues_repo_name": "renchap/react-dnd-multi-backend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/lib/__tests__/createTransition_spec.js", "max_forks_repo_name": "renchap/react-dnd-multi-backend", "max_forks_repo_forks_event_min_datetime": "2021-01-16T18:16:00.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-16T18:16:00.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 31.8636363636, "max_line_length": 59, "alphanum_fraction": 0.6990014265}
/* eslint-disable no-unused-expressions */
import { expect, sinon } from 'tests/framework';
import createTransition from '../createTransition';

describe('createTransition function', () => {
  it('creates a valid transition', () => {
    const eventName = 'test_event';
    const func = sinon.stub();

    const transition = createTransition(eventName, func);

    expect(transition._isMBTransition).to.equal(true);
    expect(transition.event).to.equal(eventName);

    const fakeEvent = {secret: Math.random()};
    expect(func).not.to.have.been.called;
    transition.check(fakeEvent);
    expect(func).to.have.been.calledOnce;
    expect(func).to.have.been.calledWithExactly(fakeEvent);
  });
});
