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

@jeetiss/callbag-marble-tester

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jeetiss/callbag-marble-tester - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

123

dist/callbag-marble-tester.es.js

@@ -1,11 +0,3 @@

var FRAME_SIZE = 10;
var FRAME_SIZE = 1;
var isDefined = function isDefined(value) {
return value != null;
};
var pick = function pick(obj, value) {
return isDefined(obj[value]) ? obj[value] : value;
};
function _extends() {

@@ -29,2 +21,10 @@ _extends = Object.assign || function (target) {

var isDefined = function isDefined(value) {
return value != null;
};
var pick = function pick(obj, value) {
return isDefined(obj[value]) ? obj[value] : value;
};
var defaultCreators = {

@@ -146,3 +146,32 @@ end: function end() {

};
var compareFrames = function compareFrames(frameA, frameB) {
if (frameA == null && frameB == null) {
return true;
}
if (typeof frameA !== typeof frameB) {
return false;
}
if (frameA.length !== frameB.length) {
return false;
}
var sink = function sink() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args.join();
};
for (var i = 0, len = frameB.length; i < len; ++i) {
if (frameA[i](sink) !== frameB[i](sink)) {
return false;
}
}
return true;
};
var listenable = function listenable(marble, values) {

@@ -204,4 +233,10 @@ if (values === void 0) {

var message = function message(expected, received) {
return "\nexpected: " + expected + "\nreceived: " + received + "\n\n";
var message = function message(expected, received, size) {
return "\nexpected: " + create({
frames: expected,
size: size
}) + "\nreceived: " + create({
frames: received,
size: size
}) + "\n\n";
};

@@ -216,2 +251,6 @@

return new Promise(function (resolve, reject) {
var _parse = parse(marble, values),
frames = _parse.frames,
size = _parse.size;
var receivedFrames = new Map();

@@ -235,20 +274,21 @@ var frame = 0;

var id;
source(0, function (t, d) {
if (t === 0) {
talkback = d;
talkback(1);
if (!id && !ended) {
id = setInterval(function () {
return frame += 1;
}, FRAME_SIZE);
}
return;
var lastCheck = function lastCheck() {
if (frame + 1 === size && create({
frames: receivedFrames,
size: size
}) === create({
frames: frames,
size: size
})) {
resolve();
} else {
reject(message(frames, receivedFrames, size));
}
};
if (t === 1) {
set(defaultCreators.next(pick(values, d)));
talkback(1);
}
source(0, function (t, d) {
if (t === 0) talkback = d;
if (t === 1) set(defaultCreators.next(pick(values, d)));
if (t === 1 || t === 0) talkback(1);

@@ -259,13 +299,22 @@ if (t === 2) {

d ? set(defaultCreators.error(d)) : set(defaultCreators.end());
talkback(2);
var received = create({
frames: receivedFrames,
size: frame + 1
});
talkback(2, d);
lastCheck();
}
if (received === marble.trim()) {
resolve();
} else {
reject(message(marble.trim(), received));
}
if (t === 0 && !ended) {
id = setInterval(function () {
if (!compareFrames(receivedFrames.get(frame), frames.get(frame))) {
clearInterval(id);
talkback(2);
reject(message(frames, receivedFrames, frame + 1));
}
if (size === frame + 1) {
clearInterval(id);
talkback(2);
lastCheck();
}
frame += 1;
}, FRAME_SIZE);
}

@@ -277,2 +326,2 @@ });

export { listenable, pullable, willBe };
export { listenable, pullable, willBe, FRAME_SIZE };

@@ -5,12 +5,4 @@ 'use strict';

var FRAME_SIZE = 10;
var FRAME_SIZE = 1;
var isDefined = function isDefined(value) {
return value != null;
};
var pick = function pick(obj, value) {
return isDefined(obj[value]) ? obj[value] : value;
};
function _extends() {

@@ -34,2 +26,10 @@ _extends = Object.assign || function (target) {

var isDefined = function isDefined(value) {
return value != null;
};
var pick = function pick(obj, value) {
return isDefined(obj[value]) ? obj[value] : value;
};
var defaultCreators = {

@@ -151,3 +151,32 @@ end: function end() {

};
var compareFrames = function compareFrames(frameA, frameB) {
if (frameA == null && frameB == null) {
return true;
}
if (typeof frameA !== typeof frameB) {
return false;
}
if (frameA.length !== frameB.length) {
return false;
}
var sink = function sink() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args.join();
};
for (var i = 0, len = frameB.length; i < len; ++i) {
if (frameA[i](sink) !== frameB[i](sink)) {
return false;
}
}
return true;
};
var listenable = function listenable(marble, values) {

@@ -209,4 +238,10 @@ if (values === void 0) {

var message = function message(expected, received) {
return "\nexpected: " + expected + "\nreceived: " + received + "\n\n";
var message = function message(expected, received, size) {
return "\nexpected: " + create({
frames: expected,
size: size
}) + "\nreceived: " + create({
frames: received,
size: size
}) + "\n\n";
};

@@ -221,2 +256,6 @@

return new Promise(function (resolve, reject) {
var _parse = parse(marble, values),
frames = _parse.frames,
size = _parse.size;
var receivedFrames = new Map();

@@ -240,20 +279,21 @@ var frame = 0;

var id;
source(0, function (t, d) {
if (t === 0) {
talkback = d;
talkback(1);
if (!id && !ended) {
id = setInterval(function () {
return frame += 1;
}, FRAME_SIZE);
}
return;
var lastCheck = function lastCheck() {
if (frame + 1 === size && create({
frames: receivedFrames,
size: size
}) === create({
frames: frames,
size: size
})) {
resolve();
} else {
reject(message(frames, receivedFrames, size));
}
};
if (t === 1) {
set(defaultCreators.next(pick(values, d)));
talkback(1);
}
source(0, function (t, d) {
if (t === 0) talkback = d;
if (t === 1) set(defaultCreators.next(pick(values, d)));
if (t === 1 || t === 0) talkback(1);

@@ -264,13 +304,22 @@ if (t === 2) {

d ? set(defaultCreators.error(d)) : set(defaultCreators.end());
talkback(2);
var received = create({
frames: receivedFrames,
size: frame + 1
});
talkback(2, d);
lastCheck();
}
if (received === marble.trim()) {
resolve();
} else {
reject(message(marble.trim(), received));
}
if (t === 0 && !ended) {
id = setInterval(function () {
if (!compareFrames(receivedFrames.get(frame), frames.get(frame))) {
clearInterval(id);
talkback(2);
reject(message(frames, receivedFrames, frame + 1));
}
if (size === frame + 1) {
clearInterval(id);
talkback(2);
lastCheck();
}
frame += 1;
}, FRAME_SIZE);
}

@@ -285,1 +334,2 @@ });

exports.willBe = willBe;
exports.FRAME_SIZE = FRAME_SIZE;
{
"name": "@jeetiss/callbag-marble-tester",
"version": "0.1.0",
"version": "0.1.1",
"description": "👜 Callbag operators for the best tests.",

@@ -5,0 +5,0 @@ "main": "dist/callbag-marble-tester.js",

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