"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 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 GenJsonCommand_1 = require("../../src/commands/GenJsonCommand");
var DefaultOptions_1 = require("../../src/commands/DefaultOptions");
describe('BaseCommand', function () {
    it('Generates example from defined options', function () {
        var command = new GenJsonCommand_1.GenJsonCommand();
        expect(command.usageExamples()).toBe(' $ plexus gen-json-meta -b metadata -o src/gen -v -e .*options.*');
    });
    it('Parses verbose flag correctly', function () {
        var command = new GenJsonCommand_1.GenJsonCommand();
        expect(command.isVerbose({})).toBe(false);
        expect(command.isVerbose(null)).toBe(false);
        expect(command.isVerbose({ verbose: 'false' })).toBe(false);
        expect(command.isVerbose({ verbose: true })).toBe(true);
        expect(command.isVerbose({ verbose: 'true' })).toBe(true);
    });
    it('Generates option args', function () {
        var command = new GenJsonCommand_1.GenJsonCommand();
        var args = command.optionArgs({
            baseDir: 'baseDir',
            out: 'out'
        }, '=');
        expect(args.join(' ')).toBe('--baseDir=baseDir --out=out');
    });
    it('Fails validation if required option not provided', function () {
        var command = new GenJsonCommand_1.GenJsonCommand();
        expect(command.validateRequiredOpts([DefaultOptions_1.baseDir()], {}).length).toBe(1);
    });
    it('Passes validation if required option provided', function () {
        var command = new GenJsonCommand_1.GenJsonCommand();
        expect(command.validateRequiredOpts([DefaultOptions_1.baseDir()], {
            baseDir: 'value'
        }).length).toBe(0);
    });
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQmFzZUNvbW1h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