My Meteor Server method calls another server to retrieve data first, cache in mongo db and then respond to request. I want to test my server code using Meteor with Velocity.
For unit test, I have a json file containing sample response from the api but I do not know how could I load that file to mock as api response for server test. Since it is server test, I cannot access jquery
or getJSONFixtures()
from jasmine-jquery
.
How can I load that json file in my server test code?
EDIT As from this answer I do not want to put my test resource files bundled as assets in /private
directory
Thanks for the nice suggestion from @sparticus.
This solved my problem:
./tests
directory. Mine is inside ./tests/resources/**/*
gulp test
) first copy them to private directory ./private/tests
. Then your test files will be available as Assets.getText(<filename>)
../private/tests
directory while you run any new tasksThis made me sure that my test resource files are not bundled during deployment.