From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@angular-devkit/schematics/testing/BUILD.bazel | 28 ++++++++ .../@angular-devkit/schematics/testing/index.d.ts | 8 +++ .../@angular-devkit/schematics/testing/index.js | 20 ++++++ .../schematics/testing/package.json | 5 ++ .../schematics/testing/schematic-test-runner.d.ts | 29 ++++++++ .../schematics/testing/schematic-test-runner.js | 82 ++++++++++++++++++++++ 6 files changed, 172 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/BUILD.bazel create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.js create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/package.json create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.d.ts create mode 100644 sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.js (limited to 'sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing') diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/BUILD.bazel b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/BUILD.bazel new file mode 100644 index 00000000..5442ff4b --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/BUILD.bazel @@ -0,0 +1,28 @@ +load("//tools:defaults.bzl", "ts_library") + +# Copyright Google Inc. All Rights Reserved. +# +# Use of this source code is governed by an MIT-style license that can be +# found in the LICENSE file at https://angular.io/license +licenses(["notice"]) + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "testing", + srcs = glob( + include = ["**/*.ts"], + ), + data = ["package.json"], + module_name = "@angular-devkit/schematics/testing", + module_root = "index.d.ts", + deps = [ + "//packages/angular_devkit/core", + "//packages/angular_devkit/schematics", + "//packages/angular_devkit/schematics/tasks", + "//packages/angular_devkit/schematics/tasks/node", + "//packages/angular_devkit/schematics/tools", + "@npm//@types/node", + "@npm//rxjs", + ], +) diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.d.ts new file mode 100644 index 00000000..3c315c83 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.d.ts @@ -0,0 +1,8 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +export * from './schematic-test-runner'; diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.js new file mode 100644 index 00000000..a01e5efa --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/index.js @@ -0,0 +1,20 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./schematic-test-runner"), exports); diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/package.json b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/package.json new file mode 100644 index 00000000..05a24826 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/package.json @@ -0,0 +1,5 @@ +{ + "name": "@angular-devkit/schematics/testing", + "main": "index.js", + "typings": "index.d.ts" +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.d.ts b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.d.ts new file mode 100644 index 00000000..055448af --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.d.ts @@ -0,0 +1,29 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { logging } from '@angular-devkit/core'; +import { Observable } from 'rxjs'; +import { DelegateTree, Rule, SchematicContext, SchematicEngine, TaskConfiguration, Tree } from '../src'; +export declare class UnitTestTree extends DelegateTree { + get files(): string[]; + readContent(path: string): string; +} +export declare class SchematicTestRunner { + private _collectionName; + private _engineHost; + private _engine; + private _collection; + private _logger; + constructor(_collectionName: string, collectionPath: string); + get engine(): SchematicEngine<{}, {}>; + get logger(): logging.Logger; + get tasks(): TaskConfiguration[]; + registerCollection(collectionName: string, collectionPath: string): void; + runSchematicAsync(schematicName: string, opts?: SchematicSchemaT, tree?: Tree): Observable; + runExternalSchematicAsync(collectionName: string, schematicName: string, opts?: SchematicSchemaT, tree?: Tree): Observable; + callRule(rule: Rule, tree: Tree, parentContext?: Partial): Observable; +} diff --git a/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.js b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.js new file mode 100644 index 00000000..e5146ac9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/@angular-devkit/schematics/testing/schematic-test-runner.js @@ -0,0 +1,82 @@ +"use strict"; +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SchematicTestRunner = exports.UnitTestTree = void 0; +const core_1 = require("@angular-devkit/core"); +const rxjs_1 = require("rxjs"); +const operators_1 = require("rxjs/operators"); +const src_1 = require("../src"); +const call_1 = require("../src/rules/call"); +const node_1 = require("../tasks/node"); +const tools_1 = require("../tools"); +class UnitTestTree extends src_1.DelegateTree { + get files() { + const result = []; + this.visit((path) => result.push(path)); + return result; + } + readContent(path) { + const buffer = this.read(path); + if (buffer === null) { + return ''; + } + return buffer.toString(); + } +} +exports.UnitTestTree = UnitTestTree; +class SchematicTestRunner { + constructor(_collectionName, collectionPath) { + this._collectionName = _collectionName; + this._engineHost = new tools_1.NodeModulesTestEngineHost(); + this._engine = new src_1.SchematicEngine(this._engineHost); + this._engineHost.registerCollection(_collectionName, collectionPath); + this._logger = new core_1.logging.Logger('test'); + const registry = new core_1.schema.CoreSchemaRegistry(src_1.formats.standardFormats); + registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults); + this._engineHost.registerOptionsTransform((0, tools_1.validateOptionsWithSchema)(registry)); + this._engineHost.registerTaskExecutor(node_1.BuiltinTaskExecutor.NodePackage); + this._engineHost.registerTaskExecutor(node_1.BuiltinTaskExecutor.RepositoryInitializer); + this._engineHost.registerTaskExecutor(node_1.BuiltinTaskExecutor.RunSchematic); + this._collection = this._engine.createCollection(this._collectionName); + } + get engine() { + return this._engine; + } + get logger() { + return this._logger; + } + get tasks() { + return [...this._engineHost.tasks]; + } + registerCollection(collectionName, collectionPath) { + this._engineHost.registerCollection(collectionName, collectionPath); + } + runSchematicAsync(schematicName, opts, tree) { + const schematic = this._collection.createSchematic(schematicName, true); + const host = (0, rxjs_1.of)(tree || new src_1.HostTree()); + this._engineHost.clearTasks(); + return schematic + .call(opts || {}, host, { logger: this._logger }) + .pipe((0, operators_1.map)((tree) => new UnitTestTree(tree))); + } + runExternalSchematicAsync(collectionName, schematicName, opts, tree) { + const externalCollection = this._engine.createCollection(collectionName); + const schematic = externalCollection.createSchematic(schematicName, true); + const host = (0, rxjs_1.of)(tree || new src_1.HostTree()); + this._engineHost.clearTasks(); + return schematic + .call(opts || {}, host, { logger: this._logger }) + .pipe((0, operators_1.map)((tree) => new UnitTestTree(tree))); + } + callRule(rule, tree, parentContext) { + const context = this._engine.createContext({}, parentContext); + return (0, call_1.callRule)(rule, (0, rxjs_1.of)(tree), context); + } +} +exports.SchematicTestRunner = SchematicTestRunner; -- cgit v1.2.3