Skip to content

Work with aldeed:collection2 #12

Open
@eric-burel

Description

@eric-burel

Hi,

This issue may refer to #8 , however I open a new one here since it seems to be a different issue.

I am using aldeed:simple-schema together with aldeed:collection2. Here is a piece of test I created:

it("Should create a clean UserState object on signup", function(){
     const userId = Meteor.call('user.signup', dummyUser.email, dummyUser.password)
     const userState = UserState.findOne({userId})

     assert.deepEqual(userState, UserState.schema.clean({userId}))
   })

UserState collection has been stubbed, and the idea of the test is that the userState object in the stub collection should have been created and cleaned.
However it is not, and userState equals {userId:"foobar"} where it should equal something similar to {userId:"foobar", someAutoGeneratedValue: {...} }.
It seems that collection2 is not applied on the stubbed collection. When I don't stub the collection, my test is passing as simple-schema clean method is applied thanks to collection2.

Is that an expected behaviour ? The problem is that I use collection2 to auto generate some value. I can't apply clean manually to my object inside my test, since I am testing the method that wraps the insert call.

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions