"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 schematics_1 = require("@angular-devkit/schematics");
const xplat_utils_1 = require("@nstudio/xplat-utils");
const testing_1 = require("@nstudio/xplat/testing");
const testing_2 = require("../../utils/testing");
xplat_utils_1.setTest();
describe('helpers schematic', () => {
    let appTree;
    beforeEach(() => {
        appTree = schematics_1.Tree.empty();
        appTree = testing_1.createXplatWithNativeScriptWeb(appTree);
    });
    // No longer needed: keeping here as example for future potential for similar helpers
    xit('imports: should create all files', () => __awaiter(void 0, void 0, void 0, function* () {
        const options = {
            name: 'imports',
        };
        // console.log('appTree:', appTree);
        const tree = yield testing_2.runSchematic('helpers', options, appTree);
        const files = tree.files;
        // console.log(files);
        // xplat helpers
        expect(tree.exists('/xplat/nativescript/utils/@nativescript/core.ts')).toBeTruthy();
        expect(files.indexOf('/xplat/nativescript/utils/@nativescript/ui.ts')).toBeGreaterThanOrEqual(0);
        expect(files.indexOf('/xplat/nativescript/utils/@nativescript/angular/core.ts')).toBeGreaterThanOrEqual(0);
        // should update tsconfig files
        let filePath = xplat_utils_1.getRootTsConfigPath();
        let fileContent = xplat_utils_1.jsonParse(testing_1.getFileContent(tree, filePath));
        // console.log(fileContent);
        expect(fileContent.compilerOptions.paths['@nativescript/*'][0]).toBe('libs/xplat/nativescript/utils/@nativescript/*');
        filePath = '/apps/nativescript-viewer/tsconfig.json';
        fileContent = xplat_utils_1.jsonParse(testing_1.getFileContent(tree, filePath));
        // console.log(fileContent);
        expect(fileContent.compilerOptions.paths['@nativescript/*'][0]).toBe('../../xplat/nativescript/utils/@nativescript/*');
    }));
});
