This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
mockis with all
npm packages installed. Try it out:
mockis lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
A self indulgent coffeescript mock of redis.
It works for certain things. It should match the success behavior of the node_redis library. Failure behavior may not match, but we try to do something sane.
It's also very incomplete. I've implemented the basic things I need. I will try to add other things as well, but if it's missing things you need, send a PR.
Multiple instances of Mockis can share the same storage like such:
parent = new Mockis() child = new Mockis() parent.addChild(child) child.set "foo", "bar", -> parent.get "foo", (err, result) -> result is "bar" # true
One important note about this is that if the child already has data, it will be lost. There is no merge.
Parents can have arbitrary numbers of children. The whole children of children thing can get wacky. Don't do it.
Contributions are totes welcome. When possible, please submit a PR for each command. This isn't a requirement, but it can streamline reviewing them.
All methods must call callbacks synchronously. Multi requires it.
Please create at least the most basic of tests for any command you add. Also, test only pull requests are greatly appreciated.