Skip to content

Instantly share code, notes, and snippets.

@matsumotius
Created November 6, 2011 10:34
Show Gist options
  • Save matsumotius/1342738 to your computer and use it in GitHub Desktop.
Save matsumotius/1342738 to your computer and use it in GitHub Desktop.
var tests = {
'フォローを削除できる' : function(test) {
var searching_user = user_dao.find({ email : 'a@example.com' }, [], {});
searching_user.on('end', function(users){
var searching_node = node_dao.find({ value : 'a' }, [], {});
searching_node.on('end', function(nodes){
var inserting_node = user_dao.add_node(users[0]._id, { node_id : nodes[0]._id });
inserting_node.on('end', function(){
var remove_node = user_dao.remove_node(users[0]._id, nodes[0]._id);
remove_node.on('end', function(){
var confirm_user = user_dao.find_by_id(users[0]._id);
confirm_user.on('end', function(user){
test.equal(user.follow.length, 0);
test.finish();
});
confirm_user.on('error', function(){ test.error(); });
});
remove_node.on('error', function(){ test.error(); });
});
inserting_node.on('error', function(node){ test.error(); });
});
searching_node.on('error', function(nodes){ test.error(); });
});
searching_user.on('error', function(){ test.error(); });
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment