'use strict';

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

require('source-map-support/register');

var _mocha = require('mocha');

var _assert = require('assert');

var _assert2 = _interopRequireDefault(_assert);

var _Plugin3 = require('../../src/agent/Plugin');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(0, _mocha.describe)('Plugin', function () {
    (0, _mocha.describe)('register', function () {
        (0, _mocha.it)('should register new class', function () {
            var Animal = function (_Plugin) {
                (0, _inherits3.default)(Animal, _Plugin);

                function Animal() {
                    (0, _classCallCheck3.default)(this, Animal);
                    return (0, _possibleConstructorReturn3.default)(this, (Animal.__proto__ || (0, _getPrototypeOf2.default)(Animal)).apply(this, arguments));
                }

                return Animal;
            }(_Plugin3.Plugin);

            var Dog = function (_Animal) {
                (0, _inherits3.default)(Dog, _Animal);

                function Dog() {
                    (0, _classCallCheck3.default)(this, Dog);
                    return (0, _possibleConstructorReturn3.default)(this, (Dog.__proto__ || (0, _getPrototypeOf2.default)(Dog)).apply(this, arguments));
                }

                return Dog;
            }(Animal);

            Animal.register('Dog', Dog);

            _assert2.default.equal(Animal.isRegistered('Dog'), true);
        });
    });

    (0, _mocha.describe)('create', function () {
        (0, _mocha.it)('should create new instance of class', function () {
            var Animal = function (_Plugin2) {
                (0, _inherits3.default)(Animal, _Plugin2);

                function Animal() {
                    (0, _classCallCheck3.default)(this, Animal);
                    return (0, _possibleConstructorReturn3.default)(this, (Animal.__proto__ || (0, _getPrototypeOf2.default)(Animal)).apply(this, arguments));
                }

                return Animal;
            }(_Plugin3.Plugin);

            var Dog = function (_Animal2) {
                (0, _inherits3.default)(Dog, _Animal2);

                function Dog(options) {
                    (0, _classCallCheck3.default)(this, Dog);

                    var _this4 = (0, _possibleConstructorReturn3.default)(this, (Dog.__proto__ || (0, _getPrototypeOf2.default)(Dog)).call(this));

                    _this4.options = options;
                    return _this4;
                }

                (0, _createClass3.default)(Dog, [{
                    key: 'puppies',
                    value: function puppies() {
                        return this.options.puppies;
                    }
                }]);
                return Dog;
            }(Animal);

            Animal.register('Dog', Dog);

            var dalmation = Animal.create('Dog', { puppies: 101 });

            _assert2.default.equal(dalmation.puppies(), 101);
        });
    });
});