"use strict";
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var chai_1 = require("chai");
var sinon_1 = require("sinon");
var inquirer = require("inquirer");
var memFs = require("mem-fs");
var fsEditor = require("mem-fs-editor");
var setup_paths_1 = require("../../steps/setup_paths");
var immutable_1 = require("immutable");
describe("setup paths", function () {
    var editor;
    var options;
    var path = process.cwd() + "/src/test/fixtures/basic_ticket_sample_app";
    beforeEach(function () {
        editor = fsEditor.create(memFs.create());
        options = immutable_1.Map({ path: path, editor: editor });
    });
    describe("when not using the --replace-v1 option", function () {
        it("should set destination to a v2 folder", function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, setup_paths_1.default(options)];
                    case 1:
                        options = _a.sent();
                        chai_1.expect(options.get("dest")).to.match(/\/v2\/$/);
                        return [2 /*return*/];
                }
            });
        }); });
    });
    describe("when using the --replace-v1 option", function () {
        var logSpy, promptStub;
        beforeEach(function () {
            logSpy = sinon_1.spy(console, "log");
            promptStub = sinon_1.stub(inquirer, "prompt").returns({ replace: "Y" });
        });
        afterEach(function () {
            logSpy.reset();
            promptStub.reset();
        });
        it("should notify the user their app will be backed up to a \"v1\" folder", function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, setup_paths_1.default(options.set("replaceV1", true))];
                    case 1:
                        options = _a.sent();
                        chai_1.expect(logSpy.calledWithMatch(sinon_1.match("v1 App will be backed up to: " + path + "/v1/")));
                        return [2 /*return*/];
                }
            });
        }); });
    });
});
