angular-unit-test-helper
Advanced tools
Comparing version 9.3.0 to 9.4.0
/// <reference types="jasmine" /> | ||
import { AbstractType, Type } from '@angular/core'; | ||
export declare function injectClass<TDependency, TReturn>(dependency: Type<TDependency> | AbstractType<TDependency>, testBed?: import("@angular/core/testing").TestBedStatic): TReturn; | ||
export declare function injectClass<TDependency>(dependency: Type<TDependency> | AbstractType<TDependency>, testBed?: import("@angular/core/testing").TestBedStatic): TDependency; | ||
export declare function injectSpy<TDependency>(dependency: Type<TDependency> | AbstractType<TDependency>, testBed?: import("@angular/core/testing").TestBedStatic): jasmine.SpyObj<TDependency>; |
{ | ||
"name": "angular-unit-test-helper", | ||
"version": "9.3.0", | ||
"version": "9.4.0", | ||
"description": "Helper functions to help write unit tests in Angular using mocks and spies", | ||
@@ -24,3 +24,3 @@ "main": "dist/index.js", | ||
"test:ci": "ts-node ./node_modules/jasmine-xml-reporter/bin/jasmine.js --config=./jasmine.json --junitreport --output=test_results/", | ||
"test:nyc": "nyc ts-node node_modules/jasmine/bin/jasmine --config=./jasmine.json --cache=false", | ||
"test:nyc": "nyc node_modules/ts-node/dist/bin.js node_modules/jasmine/bin/jasmine --config=./jasmine.json --cache=false", | ||
"init:env": "init-dev-env generate-dot-env example.env -f", | ||
@@ -50,3 +50,3 @@ "updatePeers": "npm i -D @angular/core@latest @angular/compiler@latest rxjs@latest typescript@3.7.5 jasmine@latest" | ||
"@angular/core": "^9.0.6", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
"@istanbuljs/nyc-config-typescript": "^0.1.3", | ||
"@types/jasmine": "^3.5.9", | ||
@@ -66,3 +66,3 @@ "@types/node": "^13.9.0", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^15.0.0", | ||
"nyc": "^14.1.1", | ||
"prettier": "^1.19.1", | ||
@@ -69,0 +69,0 @@ "prettier-tslint": "^0.4.2", |
@@ -6,2 +6,3 @@ # Angular Unit Test Helper | ||
[![CircleCI](https://circleci.com/gh/duluca/angular-unit-test-helper.svg?style=svg)](https://circleci.com/gh/duluca/angular-unit-test-helper) | ||
[![Coverage Status](https://coveralls.io/repos/github/duluca/angular-unit-test-helper/badge.svg)](https://coveralls.io/github/duluca/angular-unit-test-helper) | ||
@@ -129,3 +130,3 @@ ## Goal | ||
### `injectClass<TDependency, TReturn>(dependency: Type<TDependency> | AbstractType<TDependency>): TReturn` | ||
### `injectClass<TDependency>(dependency: Type<TDependency> | AbstractType<TDependency>): TDependency` | ||
@@ -138,3 +139,3 @@ Helper function to inject a dependency, like a service, into the TestBed with a typed return variable. | ||
beforeEach(() => { | ||
weatherServiceMock = injectClass(WeatherService) | ||
weatherService = injectClass(WeatherService) | ||
}) | ||
@@ -147,3 +148,3 @@ ``` | ||
beforeEach(() => { | ||
weatherServiceMock = TestBed.inject(WeatherService) as any | ||
weatherService = TestBed.inject(WeatherService) | ||
}) | ||
@@ -154,3 +155,3 @@ ``` | ||
Same as injectOne, but more descriptive to read for developers if returning a mocked SpyObj. | ||
Similar to `injectClass`, but more descriptive to read for developers if returning a mocked SpyObj. | ||
@@ -157,0 +158,0 @@ Usage |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
123668
40
629
185
1