mocking for Titanium
mockti is a mocking framework for Titanium. It loads up a
of the Titanium API and creates a
Titanium object with all of the proper
objects and methods for testing code. Every proxy is an emitter (as in Ti
itself). Methods also emit an event
function::name when invoked.
This is a continuation of my exploration of the testing of programs written for the Titanium framework. It's a Zombie.js style approach to the problem; rather than running inside of the emulators and simulating events, we instead just simulate the environment. This may prove useful for testing certain types of user interfaces and code. I've found it helpful for mocking requests for testing my network code.
Install it like this
$ npm i mockti
Then, use it like this
require'mockti';var xhr = TitaniumNetworkcreateHTTPClient;var view = TiUIcreateView;
You'll probably want to require() some of the code in your
Currently I have my project setup with a
test folder which has a couple tests;
these require code out of Resources after requiring
mockti. Then, I attempt
requests, make assertions, etc.
jscafile has type information. Add setters which assert types.