
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
web-bluetooth-mock
Advanced tools
[](https://travis-ci.org/urish/web-bluetooth-mock)
Mock for the Web Bluetooth API, useful for testing code that uses Web Bluetooth.
Copyright (C) 2017, Uri Shaked. Licensed under the terms of MIT License.
The Web Bluetooth API mock is available on npm, and can be installed by running:
npm install --save-dev web-bluetooth-mock
The following code will test whether a method called connectToDevice()
scans for a device containing a 0xffe0
service and connects to it.
It assumes jest testing framework, though the code
can be very easily adjusted for a different testing framework.
import { WebBluetoothMock, DeviceMock } from './web-bluetooth.mock';
describe('connectToDevice', () => {
it('should connect to bluetooth device', async () => {
// Setup a Mock device and register the Web Bluetooth Mock
const device = new DeviceMock('Dummy-Device', [0xffe0]);
global.navigator = global.navigator || {};
global.navigator.bluetooth = new WebBluetoothMock([device]);
// This is a Jest specific mock, change to just `spyOn(...)` for Jasmine
jest.spyOn(device.gatt, 'connect');
// Calling the method we want to be tested
await connectToDevice();
// Checking if the function has been invoked. This also means
// that requestDevice() has been called with a filter that matches
// the device we defined above.
expect(device.gatt.connect).toHaveBeenCalled();
});
});
For a more complete example, check out muse-js library tests.
FAQs
[](https://travis-ci.org/urish/web-bluetooth-mock)
The npm package web-bluetooth-mock receives a total of 12 weekly downloads. As such, web-bluetooth-mock popularity was classified as not popular.
We found that web-bluetooth-mock 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
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.