@mindhive/meteor
v25.0.6
Published
Our standard additions to Meteor
Downloads
93
Readme
Mindhive's base Meteor package
Install
npm install --save @mindhive/meteor
meteor add meteorhacks:unblock
Meteor package peer dependencies (optional)
FocusedView
:meteor add ejson
backdoorModule
:meteor add xolvio:backdoor
SimpleSchema
:meteor add aldeed:collection2-core
apiRegistry.publishComposite
:meteor add reywood:publish-composite
- client
timeModule
:meteor add mizzao:timesync
(optional, will default to local machine time otherwise) hasRole
:meteor add alanning:roles
offlineModule
:meteor add ground:[email protected]
appMarketStore
:meteor add cordova:cordova-plugin-device
,meteor add cordova:cordova-plugin-appinfo
andmeteor add cordova:cordova-plugin-market
How to use this
- See our example webapp
Dependency injection
See our DI package.
This package also makes Meteor core services available in the appContext:
Meteor
Mongo
: Meteor's Mongo, or in testing it is our ownTestMongo
(see below)Accounts
: with appropriate internal data reset each testRandom
EJSON
Users
: Meteor's 'users' Mongo collection (TestMongo
in testing)apiRegistry
: see below
...and only on the client:
Tracker
: like Meteor's Tracker but will react to both Meteor and Mobx reactive changesapi
: how to call methods on the serverstorage
: HTML5 localStoragemongoMirror
: high level mirroring of publications to Mobx domains and offline
ApiRegistry
Rather than calling Meteor.methods
and Meteor.publish
to create methods and publications
inject apiRegistry
. This has a cleaner callback (no use of this
), calls
unblock, and facilitates domain testing (see below).
TestMongo
Uses in memory MiniMongo instead of real Mongo collections to increase test speed.
But this can be override with withRealMongoCollection
for cases where you need
to use functions not available in MiniMongo.
Domain tests
- Use
mockServerContext
of@mindhvie/meteor/test
to initialise modules in test- Most likely you'll want to import and pass
@mindhvie/meteor/test/mockMeteorCoreModuleFactory
as the first module intomockServerContext
- This also sets up a fiber so Meteor code can be run in your tests
- Most likely you'll want to import and pass
- From the returned context get the mock
apiRegistry
which cancall
andsubscribe
to methods and publications in the modules being tested