Open sirganya opened 6 years ago
Import { YourComponent } from "./YourComponent"; Const yourComponent = new yourComponent();
See the testing section of the docs in basics and advanced.
On Tue, May 8, 2018, 8:13 AM Greg Kavanagh notifications@github.com wrote:
Is there a recommended strategy for importing a viewmodel into a Jest test and exposing it's methods for unit testing?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ManuelDeLeon/viewmodel-react/issues/43, or mute the thread https://github.com/notifications/unsubscribe-auth/AED31gC-6adCeHmN4PEO0LFuN9zw_UBaks5twafwgaJpZM4T2uLd .
I should have specified that I'm using Blaze. Should it work similarly?
Ah, almost the same way. With
var vm = Template.name.createViewModel();
var vm = Template.name.createViewModel(obj_with_propreties_passed_down_to_template);
See the testing part of the PhoneBook example project: https://github.com/ManuelDeLeon/phonebook/tree/master/tests/mocha/client/viewmodels
Is there a recommended strategy for importing a viewmodel into a Jest test and exposing it's methods for unit testing?