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

marsdb

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marsdb - npm Package Compare versions

Comparing version 0.5.13 to 0.5.14

5

dist/CursorObservable.js

@@ -176,2 +176,3 @@ 'use strict';

this.emit('stop');
return this;
}

@@ -193,5 +194,3 @@

if (this._updatePromise && this._updatePromise.cancel) {
this._updatePromise.cancel();
}
this._doUpdate.cancel();
this._updatePromise = immidiatelly ? this._doUpdate.func(firstRun) : this._doUpdate(firstRun);

@@ -198,0 +197,0 @@ return this._updatePromise;

@@ -135,2 +135,3 @@ import _bind from 'fast.js/function/bind';

this.emit('stop');
return this;
}

@@ -146,5 +147,3 @@

update(firstRun = false, immidiatelly = false) {
if (this._updatePromise && this._updatePromise.cancel) {
this._updatePromise.cancel();
}
this._doUpdate.cancel();
this._updatePromise = immidiatelly

@@ -151,0 +150,0 @@ ? this._doUpdate.func(firstRun)

2

package.json
{
"name": "marsdb",
"version": "0.5.13",
"version": "0.5.14",
"author": {

@@ -5,0 +5,0 @@ "name": "Artem Artemev",

@@ -374,109 +374,2 @@ import Collection from '../../lib/Collection';

describe('#debounce', function () {
it('should change debounce wait time', function (done) {
var called = false;
const cursor = new CursorObservable(db);
cursor.debounce(100);
const stopper = cursor.find({b: {$gt: 4, $lte: 7}}).observe((result) => {
called = true;
});
setTimeout(() => {
if (!called) {
done(new Error('Should be called'));
}
db.insert({b: 4.5});
called = false;
setTimeout(() => {
if (called) {
done(new Error('Can\'t be called before debounce'))
}
}, 90);
setTimeout(() => {
if (!called) {
done(new Error('Must be called after debounce'))
} else {
done();
}
}, 120);
}, 10);
});
it('should debounce update calls', function (done) {
var called = false;
const cursor = new CursorObservable(db);
cursor.debounce(100);
const stopper = cursor.find({b: {$gt: 4, $lte: 7}}).observe((result) => {
called = true;
});
setTimeout(() => {
if (!called) {
done(new Error('Should be called'));
}
db.insert({b: 4.5});
called = false;
setTimeout(() => {
if (called) {
done(new Error('Can\'t be called before debounce'));
}
db.insert({b: 4.5});
}, 90);
setTimeout(() => {
if (called) {
done(new Error('Can\'t be called before debounce'));
}
}, 110);
setTimeout(() => {
if (called) {
done(new Error('Can\'t be called before debounce'));
}
}, 190);
setTimeout(() => {
if (!called) {
done(new Error('Must be called after debounce'));
} else {
done();
}
}, 310);
}, 10);
});
});
describe('#batchSize', function () {
it('should change batchSize and apply batch update before debounce wait', function (done) {
var called = false;
const cursor = new CursorObservable(db);
cursor.debounce(10000);
cursor.batchSize(5);
const stopper = cursor.find({b: {$gt: 4, $lte: 7}}).observe((result) => {
called = true;
});
setTimeout(() => {
if (!called) {
done(new Error('Should be called'));
}
called = false;
Promise.all([1, 2, 3, 4, 5].map(x => db.insert({b: 4.5}))).then(() => {
setTimeout(() => {
if (called) {
done(new Error('Can\'t be called before debounce'));
} else {
db.insert({b: 4.5}).then(() => {
setTimeout(() => {
if (!called) {
done(new Error('Must be called after debounce'));
} else {
done();
}
}, 10);
})
}
}, 10);
});
}, 20);
});
});
describe('#maybeUpdate', function () {

@@ -519,9 +412,8 @@ it('should update when no newDoc and oldDoc provided', function () {

const cursor = new CursorObservable(db);
const oldPromise = { cancel: sinon.spy() }
cursor._updatePromise = oldPromise;
cursor._doUpdate = sinon.spy();
cursor._doUpdate.func = sinon.spy();
cursor._doUpdate.cancel = sinon.spy();
cursor.update();
oldPromise.cancel.should.have.callCount(1);
cursor._doUpdate.cancel.should.have.callCount(1);
cursor._doUpdate.should.have.callCount(1);

@@ -535,5 +427,7 @@ });

cursor._doUpdate.func.returns(1);
cursor._doUpdate.cancel = sinon.spy();
const res = cursor.update(false, true);
cursor._doUpdate.func.should.have.callCount(1);
cursor._doUpdate.should.have.callCount(0);
cursor._doUpdate.cancel.should.have.callCount(1);
res.should.be.equal(1);

@@ -540,0 +434,0 @@ });

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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