
Research
npm Malware Targets Telegram Bot Developers with Persistent SSH Backdoors
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
angular-easy-test
Advanced tools
A library that makes Angular unit tests easier to write.
npm install angular-easy-test
var EasyTest = require('angular-easy-test');
define(['angular-easy-test'], function(EasyTest) {
...
});
<script src="angular.js"></script>
<script src="angular-mocks.js"></script>
<script src="angular-easy-test.js"></script>
Here are some examples of using EasyTest
with Chai
.
describe('MyService', function() {
beforeEach(function() {
EasyTest.mockModules('myModule myDependentModule');
var services = EasyTest.injectify([ 'ServiceOne', '$q' ]);
services.ServiceOne.functionToFake = function() {
return services.$q.when('something');
};
});
it('should look like my service', function(done) {
var res = EasyTest.testService('MyService', {
'function': 'one two',
'number': 'three'
});
done(res);
});
it('some controller stuff', function() {
var context = EasyTest.createTestContext('MyController');
expect(context.$scope).to.have.property('something');
context.controller.myFunction();
expect(context.controller.state).to.equal('something');
});
it('some service stuff', function() {
var service = EasyTest.getService('MyService');
service.something();
EasyTest.getService('$rootScope').$digest();
expect(service.property).to.equal('something');
});
it('some directive stuff', function() {
var element = EasyTest.compileDirective('<div my-directive></div>');
expect(element.find('li')).to.have.length(10);
});
});
angular-easy-test is built on top of AngularJS's ngMock. Here is the same set of test cases implemented using just ngMock:
describe('MyService', function() {
beforeEach(module('myModule', 'myDependentModule', function($provide, $q) {
$provide.value('ServiceOne', {
functionToFake: function() {
return $q.when('something');
};
})
}));
it('should look like my service', inject(function(MyService) {
expect(MyService.one).to.be.a('function');
expect(MyService.two).to.be.a('function');
expect(MyService.three).to.be.a('number');
}));
it('some controller stuff', inject(function($rootScope, $controller) {
var scope = $rootScope.$new();
var ctrl = $controller('MyController', {
$scope: scope
})
expect(scope).to.have.property('something');
ctrl.myFunction();
expect(ctrl.state).to.equal('something');
}));
it('some service stuff', inject(function($rootScope, MyService) {
MyService.something();
$rootScope.$digest();
expect(MyService.property).to.equal('something');
}));
it('some directive stuff', inject(function($compile, $rootScope) {
var element = $compile('<div my-directive></div>')($rootScope.$new());
expect(element.find('li')).to.have.length(10);
}));
});
See the jsdocs.
FAQs
Framework for making Angular Unit Test's easier to write.
The npm package angular-easy-test receives a total of 287 weekly downloads. As such, angular-easy-test popularity was classified as not popular.
We found that angular-easy-test 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.
Research
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
Security News
pip, PDM, pip-audit, and the packaging library are already adding support for Python’s new lock file format.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.