Skip to content

Commit

Permalink
move tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Feb 6, 2012
1 parent 4664788 commit c926053
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
33 changes: 33 additions & 0 deletions test/events-test.js
Expand Up @@ -550,5 +550,38 @@ module.exports = simpleEvents({
test.expect(2);

},
'31. Raise event on `move` method invokation for any key': function(test) {

var vat = EventVat();
var vat2 = EventVat();

vat.on('move', function(key, db) {
test.equal(key, 'foo');
test.equal(db, vat2);
vat.die();
test.done();
});

vat.set('foo', 'bar');
vat.move('foo', vat2);
test.expect(2);

},
'32. Raise event on `move` method invokation for a particular key': function(test) {

var vat = EventVat();
var vat2 = EventVat();

vat.on('move foo', function(db) {
test.equal(db, vat2);
vat.die();
test.done();
});

vat.set('foo', 'bar');
vat.move('foo', vat2);
test.expect(1);

},

});
21 changes: 20 additions & 1 deletion test/methods-test.js
Expand Up @@ -306,5 +306,24 @@ this.methodSuite = {
vat.die();
test.done();

}
},
'Invoke `move` method and report keys in both databases before and after': function(test) {

var vat = EventVat();
var vat2 = EventVat();

vat.set('foo', 42);

test.equal(vat.get('foo'), 42);
test.equal(vat2.get('foo'), false);

vat.move('foo', vat2);

test.equal(vat.get('foo'), false);
test.equal(vat2.get('foo'), 42);

vat.die();
test.done();

},
};

0 comments on commit c926053

Please sign in to comment.