"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var service_1 = require("../partial-src/concept/service");
function run() {
    describe("APIFactory test", function () {
        it("Monkey", function (done) {
            var factory = new Leaf.APIFactory({
                prefix: "/api/",
                bodyType: "json",
                errorMapper: function (err) {
                    return err;
                }
            });
            var APIService = (function (_super) {
                __extends(APIService, _super);
                function APIService() {
                    var _this = _super !== null && _super.apply(this, arguments) || this;
                    _this.name = "APIService";
                    _this.register = factory.createAPIFunction({
                        method: "GET",
                        path: "user"
                    });
                    _this.echo = factory.createAPIFunction({
                        method: "GET",
                        path: "echo"
                    });
                    _this.echoError = factory.createAPIFunction({
                        method: "POST",
                        path: "echo/error"
                    });
                    _this.test = factory.createAPIFunction({
                        method: "POST",
                        path: "test/search/:id"
                    });
                    return _this;
                }
                return APIService;
            }(service_1.Service));
            var s = new APIService();
            s.test({ id: "debug", problem: "wrong" }, function (err) {
                console.error(err);
                done();
            });
            s.test({ id: "2", problem: "wrong" }, function (err) {
                console.error(err);
                done();
            });
            done();
        });
    });
}
exports.run = run;
//# sourceMappingURL=api.test.js.map