"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@angular-devkit/core");
const testing_1 = require("@angular-devkit/schematics/testing");
const path = require("path");
const collectionPath = path.join(__dirname, "../../collection.json");
const workspaceOptions = {
    name: "workspace",
    newProjectRoot: "projects",
    version: "6.0.0",
};
const appOptions = {
    name: "schematest",
};
let appTree;
const schematicRunner = new testing_1.SchematicTestRunner("ng-add", collectionPath);
describe("Initilization", () => {
    beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
        appTree = yield schematicRunner
            .runExternalSchematicAsync("@schematics/angular", "workspace", workspaceOptions)
            .toPromise();
        appTree = yield schematicRunner
            .runExternalSchematicAsync("@schematics/angular", "application", appOptions, appTree)
            .toPromise();
    }));
    it("No demo app installation should work", () => __awaiter(void 0, void 0, void 0, function* () {
        const tree = yield schematicRunner
            .runSchematicAsync("ng-add", { project: "default", contractName: 'CustomName', uiFramework: "primeNG", test: true, demoToInstall: false, addOns: [], dappDemo: "minimalContract" }, appTree)
            .toPromise();
        const app_module_file = tree.readContent("/projects/schematest/src/app/app.module.ts");
        expect(tree.files.length).toBeGreaterThan(2);
    }));
    it("No demo app should add custom Contract name", () => __awaiter(void 0, void 0, void 0, function* () {
        const tree = yield schematicRunner
            .runSchematicAsync("ng-add", { project: "default", contractName: 'CustomName', uiFramework: "primeNG", test: true, demoToInstall: false, addOns: [], dappDemo: "minimalContract" }, appTree)
            .toPromise();
        expect(tree.exists((0, core_1.normalize)('/projects/schematest/src/app/custom-name/custom-name.module.ts'))).toBeTrue();
    }));
});
//# sourceMappingURL=ui_framework_tests.js.map