Skip to content

Commit

Permalink
finite-state-machine: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
humanamburu authored and humanamburu committed Feb 2, 2017
1 parent 2d3e42c commit 2d9677c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 33 deletions.
31 changes: 0 additions & 31 deletions test/config.js

This file was deleted.

32 changes: 30 additions & 2 deletions test/fsm.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
const FSM = require('../src/fsm');
const config = require('./config');

/** Good luck! :) **/

/** visualisation https://i.imgur.com/07IO6TE.png **/
const config = {
initial: 'normal',
states: {
normal: {
transitions: {
study: 'busy',
}
},
busy: {
transitions: {
get_tired: 'sleeping',
get_hungry: 'hungry',
}
},
hungry: {
transitions: {
eat: 'normal'
},
},
sleeping: {
transitions: {
get_hungry: 'hungry',
get_up: 'normal',
},
},
}
};

describe('FSM', () => {
describe('#constructor', () => {
it('throws an exception if config isn\'t passed', () => {
Expand Down Expand Up @@ -254,4 +282,4 @@ describe('FSM', () => {
expect(student.redo()).to.be.false;
});
});
});
});

0 comments on commit 2d9677c

Please sign in to comment.