
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
ng2-mock-component
Advanced tools
A very simple Angular 2 module for mocking components in unit tests.
npm install --save-dev ng2-mock-component
Just specify the selector
of the component you wish to mock (along with whatever other
metadata properties
you like), and MockComponent
will supply that component with an empty template (unless you provide
a template string, in which case, it'll use that instead).
import { TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { MyComponent } from './src/my.component';
import { MockComponent } from 'ng2-mock-component';
describe('MyComponent', () => {
let fixture, element;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
MyComponent,
MockComponent({ selector: 'my-subcomponent' })
]
});
fixture = TestBed.createComponent(MyComponent);
element = fixture.debugElement;
});
it('works', () => {
fixture.detectChanges();
expect(element.query(By.css('my-subcomponent'))).not.toBeNull();
});
});
Christian Nunciato (chris@nunciato.org)
FAQs
An Angular 2 module for mocking components.
The npm package ng2-mock-component receives a total of 10,030 weekly downloads. As such, ng2-mock-component popularity was classified as popular.
We found that ng2-mock-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.