New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 1.1.2 to 1.2.0

2

dist/createComponentMock.d.ts

@@ -1,1 +0,1 @@

export declare function createComponentMock(className: string, selectorName?: string): any;
export declare function createComponentMock(className: string, selectorName?: string, template?: string): any;
import { Component } from '@angular/core';
import camelToKebabCase from 'camel-to-kebab';
import { __decorate } from 'tslib';
export function createComponentMock(className, selectorName) {
export function createComponentMock(className, selectorName, template) {
if (template === void 0) { template = ''; }
if (!className || !className.endsWith('Component')) {

@@ -12,3 +13,3 @@ throw 'Expected class name to end with Component, but it did not. Provide a valid component class name.';

var newClass = (window[className] = function () { });
return __decorate([Component({ selector: 'app-current-weather', template: '' })], newClass);
return __decorate([Component({ selector: selectorName, template: template })], newClass);
}

@@ -15,0 +16,0 @@ function inferSelectorName(className) {

@@ -5,3 +5,7 @@ import { Component } from '@angular/core'

export function createComponentMock(className: string, selectorName?: string) {
export function createComponentMock(
className: string,
selectorName?: string,
template = ''
) {
if (!className || !className.endsWith('Component')) {

@@ -16,6 +20,3 @@ throw 'Expected class name to end with Component, but it did not. Provide a valid component class name.'

const newClass: any = ((window as any)[className] = () => {})
return __decorate(
[Component({ selector: 'app-current-weather', template: '' })],
newClass
)
return __decorate([Component({ selector: selectorName, template: template })], newClass)
}

@@ -22,0 +23,0 @@

{
"name": "angular-unit-test-helper",
"version": "1.1.2",
"version": "1.2.0",
"description": "Helper functions to help write unit tests in Angular using mocks and spies",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -41,3 +41,3 @@ # Angular Unit Test Helper

### createComponentMock(className: string, selectorName?: string)
### createComponentMock(className: string, selectorName?: string, template = '')

@@ -55,2 +55,4 @@ Creates a mock class decorated with @Component, if not specified selector is inferred to be MyClassComponent -> app.

Option to override empty template.
Usage

@@ -57,0 +59,0 @@ ```

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