"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Copyright 2017-2020 Plexus Interop Deutsche Bank AG
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var setup_1 = require("./setup");
var path = require("path");
var ListMetaFilesCommand_1 = require("../../src/commands/ListMetaFilesCommand");
var files_1 = require("../../src/common/files");
describe('List metadata files CLI command', function () {
    it('Generates files based on proto file', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
        var testName, genCommand, outDir, _a;
        return tslib_1.__generator(this, function (_b) {
            switch (_b.label) {
                case 0:
                    testName = 'generated-file-list-proto';
                    genCommand = new ListMetaFilesCommand_1.ListMetaFilesCommand();
                    outDir = setup_1.prepareOutDir(testName);
                    console.log(setup_1.getInvalidTestBaseDir());
                    return [4 /*yield*/, genCommand.action({
                            out: outDir + '/files.json',
                            baseDir: setup_1.getInvalidTestBaseDir(),
                            input: 'services.proto'
                        })];
                case 1:
                    _b.sent();
                    _a = expect;
                    return [4 /*yield*/, files_1.readTextFile(path.join(outDir, 'files.json'))];
                case 2:
                    _a.apply(void 0, [_b.sent()]).toMatch('messages');
                    return [2 /*return*/];
            }
        });
    }); }, 15000);
    it('Generates files based on interop file', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
        var testName, genCommand, outDir, _a;
        return tslib_1.__generator(this, function (_b) {
            switch (_b.label) {
                case 0:
                    testName = 'generated-file-list-interop';
                    genCommand = new ListMetaFilesCommand_1.ListMetaFilesCommand();
                    outDir = setup_1.prepareOutDir(testName);
                    return [4 /*yield*/, genCommand.action({
                            out: outDir + '/files.json',
                            baseDir: setup_1.getTestBaseDir(),
                            input: 'greeting_client.interop'
                        })];
                case 1:
                    _b.sent();
                    _a = expect;
                    return [4 /*yield*/, files_1.readTextFile(path.join(outDir, 'files.json'))];
                case 2:
                    _a.apply(void 0, [_b.sent()]).toMatch('greeting_service');
                    return [2 /*return*/];
            }
        });
    }); }, 15000);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTGlzdE1ldGFGaWxlc0NvbW1hbmQuc3BlYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Rlc3RzL2NvbW1hbmRzL0xpc3RNZXRhRmlsZXNDb21tYW5kLnNwZWMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUE7Ozs7Ozs7Ozs7Ozs7OztHQWVHO0FBQ0gsaUNBQStFO0FBQy9FLDJCQUE2QjtBQUM3QixnRkFBK0U7QUFDL0UsZ0RBQXNEO0FBRXRELFFBQVEsQ0FBQyxpQ0FBaUMsRUFBRTtJQUV4QyxFQUFFLENBQUMscUNBQXFDLEVBQUU7Ozs7O29CQUVoQyxRQUFRLEdBQUcsMkJBQTJCLENBQUM7b0JBQ3ZDLFVBQVUsR0FBRyxJQUFJLDJDQUFvQixFQUFFLENBQUM7b0JBQ3hDLE1BQU0sR0FBRyxxQkFBYSxDQUFDLFFBQVEsQ0FBQyxDQUFDO29CQUd2QyxPQUFPLENBQUMsR0FBRyxDQUFDLDZCQUFxQixFQUFFLENBQUMsQ0FBQztvQkFFckMscUJBQU0sVUFBVSxDQUFDLE1BQU0sQ0FBQzs0QkFDcEIsR0FBRyxFQUFFLE1BQU0sR0FBRyxhQUFhOzRCQUMzQixPQUFPLEVBQUUsNkJBQXFCLEVBQUU7NEJBQ2hDLEtBQUssRUFBRSxnQkFBZ0I7eUJBQzFCLENBQUMsRUFBQTs7b0JBSkYsU0FJRSxDQUFDO29CQUVILEtBQU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