"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var qs = tslib_1.__importStar(require("qs"));
var utils_1 = require("src/validate/utils");
var consts_1 = require("../consts");
describe('validate/utils', function () {
    var pathTpl = '/{id}/{name}/';
    var path = '/2/yqj/';
    it('getPathParamsNames ok', function () {
        expect(utils_1.getPathParamsNames(pathTpl)).toMatchObject(Object.keys(consts_1.testJSON));
    });
    it('concatPath ok', function () {
        expect(utils_1.concatPath('/', ['/a'], undefined, 'b')).toEqual('/a/b');
    });
    it('getPathParams ok', function () {
        expect(utils_1.getPathParams(pathTpl, path)).toEqual(consts_1.testJSON);
    });
    it('getParams ok', function () {
        expect(utils_1.getParams(consts_1.Request)).toMatchSnapshot();
    });
    it('getReadableDataAsync ok', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
        var stream, data;
        return tslib_1.__generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    stream = consts_1.mockRequest({});
                    return [4 /*yield*/, utils_1.getReadableDataAsync(stream)];
                case 1:
                    data = _a.sent();
                    expect(data).toEqual(qs.stringify(consts_1.testJSON));
                    return [2 /*return*/];
            }
        });
    }); });
});
//# sourceMappingURL=utils.test.js.map