attempted to write a test for hasmany all function. this commit has it commented out
This commit is contained in:
parent
6f9c495720
commit
84a9582bc0
|
@ -542,6 +542,29 @@ function testOrm(schema) {
|
|||
it('hasMany should be cached', function (test) {
|
||||
//User.create(function (e, u) {
|
||||
// u.posts.create({}, function (e, p) {
|
||||
// find all posts for a user.
|
||||
/* User.all(function (err,users) {
|
||||
for (var i=0;i<users.length;i++) {
|
||||
u = users[i];
|
||||
Posts.find(user.id, function(err, posts) {
|
||||
// now check to see that the user has these posts testing the all method of hasMany.
|
||||
u.posts.all(null,function(err, uposts) {
|
||||
test.equal(posts.length,uposts.length);
|
||||
if (post.length == uposts.length) {
|
||||
for (var j=0;j<uposts.length;j++) {
|
||||
for (var k= 0,found=false;k<posts.length;k++) {
|
||||
if (uposts[j] == uposts[k].id) { found = true; break; }
|
||||
}
|
||||
if (!found) test.equal(1,0); // not familliar with test framework here... test.fail()?
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
// find the posts with this user id.
|
||||
// find the posts of the user.
|
||||
|
||||
}
|
||||
})*/
|
||||
// Finding one post with an existing author associated
|
||||
Post.all(function (err, posts) {
|
||||
// We try to get the first post with a userId != NULL
|
||||
|
|
Loading…
Reference in New Issue