<commit_before>Object.keys(promises).forEach(function (promise) {

  describe('Initialisation: ' + promise, function () {

    it('should default to "none" state', function () {
      StateMachine.Promise = promises[promise];

      var fsm = StateMachine({
        events: [
          { name: 'start', from: 'one', to: 'another' }
        ]
      });

      expect(fsm.current).to.be.equal('none');
    });

    it('should initialize to provided state', function () {
      StateMachine.Promise = promises[promise];

      var fsm = StateMachine({
        initial: 'green',
        events: [
          { name: 'warn',  from: 'green',  to: 'yellow' },
          { name: 'panic', from: 'yellow', to: 'red'    },
          { name: 'calm',  from: 'red',    to: 'yellow' },
          { name: 'clear', from: 'yellow', to: 'green'  }
      ]});

      expect(fsm.current).to.be.equal('green');
    });

    it('should throw error on transition with array value for \'to\'', function (done) {
      StateMachine.Promise = promises[promise];
      
      try {
        var fsm = StateMachine({
          initial: 'here',
          events: [
            { name: 'jump', from: 'here', to: ['here', 'there'] }
          ]
        });
      } catch (e) {
        expect(e.message).to.be.equal('Ambigous transition jump');

        done();
      }
    });

  });
});<commit_msg>added test for verifying the use of configured promise library<commit_after>Object.keys(promises).forEach(function (promise) {

  describe('Initialisation: ' + promise, function () {

    it('should default to "none" state', function () {
      StateMachine.Promise = promises[promise];

      var fsm = StateMachine({
        events: [
          { name: 'start', from: 'one', to: 'another' }
        ]
      });

      expect(fsm.current).to.be.equal('none');
    });

    it('should initialize to provided state', function () {
      StateMachine.Promise = promises[promise];

      var fsm = StateMachine({
        initial: 'green',
        events: [
          { name: 'warn',  from: 'green',  to: 'yellow' },
          { name: 'panic', from: 'yellow', to: 'red'    },
          { name: 'calm',  from: 'red',    to: 'yellow' },
          { name: 'clear', from: 'yellow', to: 'green'  }
      ]});

      expect(fsm.current).to.be.equal('green');
    });

    it('should throw error on transition with array value for \'to\'', function (done) {
      StateMachine.Promise = promises[promise];

      try {
        var fsm = StateMachine({
          initial: 'here',
          events: [
            { name: 'jump', from: 'here', to: ['here', 'there'] }
          ]
        });
      } catch (e) {
        expect(e.message).to.be.equal('Ambigous transition jump');

        done();
      }
    });

    it('should use the configured promise library', function (done) {
      StateMachine.Promise = promises[promise];

      fsm = StateMachine({
        initial: 'init',
        events: [
          { name: 'test', from: 'init' }
        ],
        callbacks: {
          ontest: function (options) {
            expect(StateMachine.Promise).to.be.deep.equal(promises[promise]);
          }
        }
      });

      fsm.test().then(function () {
        done();
      });
    });

  });
});
{'fraction_non_alphanumeric': 0.16953316953316952, 'fraction_numerical': 0.0, 'mean_word_length': 2.041083099906629, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5059613', 'n_tokens_mistral': 1000, 'n_tokens_neox': 958, 'n_words': 229}