"use strict";
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var chai_1 = require("chai");
var memFs = require("mem-fs");
var fsEditor = require("mem-fs-editor");
var setup_app_scaffold_1 = require("../../steps/setup_app_scaffold");
var immutable_1 = require("immutable");
describe("setup app scaffold", function () {
    var editor;
    var options;
    var cwd = process.cwd();
    var src = cwd + "/src/test/fixtures/basic_ticket_sample_app";
    var dest = cwd + "/src/test/fixtures/basic_ticket_sample_app/v2";
    beforeEach(function () {
        editor = fsEditor.create(memFs.create());
        options = immutable_1.Map({ src: src, dest: dest, editor: editor });
    });
    it("should copy the app scaffold to the destination", 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_app_scaffold_1.default(options)];
                case 1:
                    _a.sent();
                    chai_1.expect(editor.readJSON(dest + "/package.json").name).to.equal("app_scaffold");
                    return [2 /*return*/];
            }
        });
    }); });
    it("should include dotfiles when copying", 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_app_scaffold_1.default(options)];
                case 1:
                    _a.sent();
                    chai_1.expect(editor.exists(dest + "/.eslintrc")).to.be.true;
                    return [2 /*return*/];
            }
        });
    }); });
    it("should add custom eslint configuration", function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
        var eslintConfig;
        return tslib_1.__generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, setup_app_scaffold_1.default(options)];
                case 1:
                    _a.sent();
                    eslintConfig = editor.readJSON(dest + "/.eslintrc", { rules: {} });
                    chai_1.expect(eslintConfig.rules).to.have.property("no-unused-vars", 0);
                    chai_1.expect(eslintConfig).to.have.property("root", true);
                    return [2 /*return*/];
            }
        });
    }); });
});
