Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rqlite-fp

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rqlite-fp - npm Package Compare versions

Comparing version 2.9.0 to 2.10.0

promises.js

2

package.json
{
"name": "rqlite-fp",
"version": "2.9.0",
"version": "2.10.0",
"keywords": [

@@ -5,0 +5,0 @@ "rqlite",

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

const http = require('http');
const righto = require('righto');

@@ -20,2 +21,39 @@ const tape = require('tape');

test('connect with no callback', function * (t) {
t.plan(1);
try {
connect('http://localhost:4001');
} catch (error) {
t.equal(error.message, 'rqlite.connect requires a callback');
}
});
test('connect to something not rqlite - json', function * (t) {
t.plan(1);
const server = http.createServer((request, response) => {
response.writeHead(200, { 'Content-Type': 'application/json' });
response.end('{"a":1}');
}).listen(4002);
connect('http://localhost:4002', (error, result) => {
t.equal(error.message, 'url does not look like an rqlite database');
server.close();
});
});
test('connect to something not rqlite - not json', function * (t) {
t.plan(1);
const server = http.createServer((request, response) => {
response.end('im not rqlite');
}).listen(4002);
connect('http://localhost:4002', (error, result) => {
t.equal(error.message, 'The response body could not be JSON.parsed');
server.close();
});
});
test('connect when not running', function * (t) {

@@ -41,2 +79,26 @@ t.plan(1);

test('connect with retries when not running - with no retires set', function * (t) {
t.plan(3);
const startTime = Date.now();
connect('http://localhost:4001', { retries: 3 }, function (error) {
const endTime = Date.now();
t.ok(endTime - startTime > 300, 'Took more than 300ms to fail');
t.ok(endTime - startTime > 300, 'Took less than 1000ms to fail');
t.equal(error.message, 'ECONNREFUSED: Could not connect to http://localhost:4001');
});
});
test('connect with retries when not running', function * (t) {
t.plan(3);
const startTime = Date.now();
connect('http://localhost:4001', { retries: 3, retryDelay: 100 }, function (error) {
const endTime = Date.now();
t.ok(endTime - startTime > 300, 'Took more than 300ms to fail');
t.ok(endTime - startTime > 300, 'Took less than 1000ms to fail');
t.equal(error.message, 'ECONNREFUSED: Could not connect to http://localhost:4001');
});
});
test('connect with retries with onRetry', function * (t) {

@@ -43,0 +105,0 @@ t.plan(1);

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