Socket
Book a DemoInstallSign in
Socket

react-native-ble-plx-mock-recorder

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-ble-plx-mock-recorder

Mock recorder and playback tool for react-native-ble-plx

0.0.6
latest
Source
npmnpm
Version published
Weekly downloads
88
91.3%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-ble-plx-mock-recorder

Build Status

Mock recorder and playback tool for react-native-ble-plx. Enables fast and robust integration tests for your Bluetooth/BLE app.

Overview

This tool will help developers of React Native apps that talk to Bluetooth/BLE devices. Avoid having a lot of slow and fragile end-to-end tests taking more than an hour to run on physical devices and a physical CI server!

If you can run your UI tests with pre-recorded BLE traffic, you get very fast and robust tests, that are actual integration tests, since you are not writing your mocks by hand.

You will create a separate mock recorder app, using the "react-native-ble-plx-mock-recorder-mocha-template" template for React Native to occasionally record actual traffic needed by your tests.

Then use this library to play back the BLE traffic every time you run your Jest UI tests, and enjoy the speed of up to 100 of tests per second.

For more information, check out the blog post.

Prerequisites

  • A Bluetooth/BLE device, powered on, nearby, not connected to a phone.
  • A React Native app talking to the BLE device.
  • An Android phone, plugged into your computer.
    • (Support for iPhone is planned).
  • A React Native development environment: https://reactnative.dev/docs/environment-setup.
  • bash on your path.

Demo

npm install
npm run demo:app
# then close the app and the Metro popup terminal window
npm run demo:recorder
# from here on you can unplug phone and power down BLE device
npm run demo:app:test

Getting started

To get started, read how to build your own demo from scratch. Then apply the same steps to the app you would like to test.

API

TODO

Architecture

See ARCHITECTURE.md

Limitations

Currently a large part of the central API of react-native-ble-plx is implemented, but several methods which have not been needed yet, are missing. They should be easy to add. Feel free to submit a Pull Request!

Contributing

Contributions are welcome! Please open an issue with your suggestions and/or submit a PR. PRs should pass npm test and not decrease code coverage.

Contributors

@larsthorup
@larsthorup
@muscapades
@muscapades

Publish to npm

# git commit && git push
# wait for CI to pass
# clean workspace
git checkout main
git pull
npm run test:e2e
npm run bump
npm run publish
# git commit && git push

Then manually verify local react-native-ble-plx-mock-recorder-mocha-template and publish that.

FAQs

Package last updated on 07 Jul 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.