Skip to content

Using pinia-orm in vitest. Cannot instantiate models? #1538

Answered by CodeDredd
dschreij asked this question in Q&A
Discussion options

You must be logged in to vote

@dschreij
yes you can do that. you can just fill the models with the data and how it is set, is defined by the options. Look for example at some of the model unit test: https://github.com/CodeDredd/pinia-orm/blob/master/packages/pinia-orm/tests/unit/model/Model.spec.ts

Maybe i write some helper to mock useRepo with return values. I think this will also make testing way easier so that you dont need the store at all.

in your case the best way is to set the models by new Model({...fields}, { operation: 'get' })

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dschreij
Comment options

@CodeDredd
Comment options

Answer selected by CodeDredd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants