Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-unit-test-helper

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-unit-test-helper - npm Package Compare versions

Comparing version 9.1.1 to 9.1.2

tests/autoSpyObj.spec.ts

6

dist/autoSpyObj.d.ts

@@ -6,2 +6,6 @@ export declare enum ObservablePropertyStrategy {

}
export declare function autoSpyObj(classUnderTest: () => any, spyProperties?: string[], observableStrategy?: ObservablePropertyStrategy): any;
export declare function autoSpyObj({ classUnderTest, spyProperties, observableStrategy, }: {
classUnderTest: NewableFunction;
spyProperties?: string[];
observableStrategy?: ObservablePropertyStrategy;
}): any;

3

package.json
{
"name": "angular-unit-test-helper",
"version": "9.1.1",
"version": "9.1.2",
"description": "Helper functions to help write unit tests in Angular using mocks and spies",

@@ -50,2 +50,3 @@ "main": "dist/index.js",

"devDependencies": {
"@angular/compiler": "^9.0.5",
"@angular/core": "^9.0.5",

@@ -52,0 +53,0 @@ "@istanbuljs/nyc-config-typescript": "^1.0.1",

@@ -12,7 +12,11 @@ import { BehaviorSubject, Observable } from 'rxjs'

export function autoSpyObj(
classUnderTest: () => any,
spyProperties: string[] = [],
observableStrategy = ObservablePropertyStrategy.Observable
) {
export function autoSpyObj({
classUnderTest,
spyProperties = [],
observableStrategy = ObservablePropertyStrategy.Observable,
}: {
classUnderTest: NewableFunction
spyProperties?: string[]
observableStrategy?: ObservablePropertyStrategy
}) {
const props = Reflect.ownKeys(classUnderTest.prototype)

@@ -19,0 +23,0 @@ const spyObj = jasmine.createSpyObj(

@@ -20,6 +20,13 @@ import { Component } from '@angular/core'

const newClass: any = ((window as any)[className] = () => {})
const newClass: any = (getWindow()[className] = () => {})
return __decorate([Component({ selector: selectorName, template })], newClass)
}
function getWindow(): any {
if (typeof window === 'undefined') {
return {}
}
return window
}
function inferSelectorName(className: string) {

@@ -26,0 +33,0 @@ className = className.replace('Component', '')

{
"compilerOptions": {
"baseUrl": "./",
"moduleResolution": "node",

@@ -15,3 +14,2 @@ "emitDecoratorMetadata": true,

"declaration": true,
"outDir": "./dist",
"sourceMap": true,

@@ -29,4 +27,3 @@ "noImplicitAny": true,

"resolveJsonModule": true
},
"include": ["./src"]
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc