UNPKG

@nstudio/ionic

Version:

Ionic Plugin for xplat

59 lines (58 loc) 3.29 kB
"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 testing_1 = require("@nstudio/xplat/testing"); const testing_2 = require("../../utils/testing"); describe('ionic app', () => { let appTree; const defaultOptions = { name: 'foo', npmScope: 'testing', prefix: 'tt', }; beforeEach(() => { appTree = schematics_1.Tree.empty(); appTree = (0, testing_1.createEmptyWorkspace)(appTree); }); it('should create all files of an app', () => __awaiter(void 0, void 0, void 0, function* () { const options = Object.assign({}, defaultOptions); // console.log('appTree:', appTree); const tree = yield (0, testing_2.runSchematic)('app', options, appTree); const files = tree.files; // console.log(files); expect(files.indexOf('/apps/ionic-foo/.gitignore')).toBeGreaterThanOrEqual(0); expect(files.indexOf('/apps/ionic-foo/capacitor.config.ts')).toBeGreaterThanOrEqual(0); expect(files.indexOf('/apps/ionic-foo/stencil.config.ts')).toBeGreaterThanOrEqual(0); expect(files.indexOf('/apps/ionic-foo/package.json')).toBeGreaterThanOrEqual(0); expect(files.indexOf('/apps/ionic-foo/tsconfig.json')).toBeGreaterThanOrEqual(0); // source dir expect(files.indexOf('/apps/ionic-foo/src/global/app.css')).toBeGreaterThanOrEqual(0); expect(files.indexOf('/apps/ionic-foo/src/index.html')).toBeGreaterThanOrEqual(0); expect(files.indexOf('/apps/ionic-foo/src/components.d.ts')).toBeGreaterThanOrEqual(0); })); it('should create all files for app in directory', () => __awaiter(void 0, void 0, void 0, function* () { const options = Object.assign({}, defaultOptions); options.directory = 'frontend'; const tree = yield (0, testing_2.runSchematic)('app', options, appTree); // const files = tree.files; // console.log(files); expect(tree.exists('/apps/frontend/ionic-foo/src/index.html')).toBeTruthy(); })); it('should create all files for app in directory and ignore platform naming when directory is a platform', () => __awaiter(void 0, void 0, void 0, function* () { const options = Object.assign({}, defaultOptions); options.directory = 'ionic'; const tree = yield (0, testing_2.runSchematic)('app', options, appTree); // const files = tree.files; // console.log(files); expect(tree.exists('/apps/ionic/foo/src/index.html')).toBeTruthy(); })); });