(function() {
  var Yie;
  var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };

  require("should");

  Yie = require("../lib/yobiengine");

  describe("Statemachine", function() {
    it("should have the first state as initial substate", function() {
      var Person, person;
      Person = (function() {

        __extends(Person, Yie.StateMachine);

        function Person() {
          Person.__super__.constructor.apply(this, arguments);
        }

        Person.prototype.name = null;

        Person.states(function() {
          return this.state("Mood", function() {
            return this.state("Happy", function() {
              this.state("Very");
              return this.state("Little");
            });
          });
        });

        return Person;

      })();
      person = new Person;
      person.isIn("Mood").should.be["true"];
      person.isIn("Happy").should.be["true"];
      person.isIn("Very").should.be["true"];
      person.isCurrentlyIn("Very").should.be["true"];
      return person.isIn("Little").should.be["false"];
    });
    return it("should have concurrent substates", function() {
      var Person, person;
      Person = (function() {

        __extends(Person, Yie.StateMachine);

        function Person() {
          Person.__super__.constructor.apply(this, arguments);
        }

        Person.prototype.name = null;

        Person.states(function() {
          return this.state("Mood", {
            concurrent: false
          }, function() {
            this.state("Happy", function() {
              this.state("Very");
              return this.state("Little");
            });
            return this.state("Angry", function() {
              this.state("Yes");
              return this.state("No");
            });
          });
        });

        return Person;

      })();
      person = new Person;
      person.isIn("Mood").should.be["true"];
      person.isIn("Happy").should.be["true"];
      person.isIn("Very").should.be["true"];
      person.isCurrentlyIn("Very").should.be["true"];
      person.isIn("Little").should.be["false"];
      person.isIn("Angry").should.be["true"];
      person.isIn("Yes").should.be["true"];
      person.isCurrentlyIn("Yes").should.be["true"];
      return person.isIn("No").should.be["false"];
    });
  });

}).call(this);
