Introducing tests and adding support for promises

Introducing tests, as requested.
The issue with promises in model is now solved.
Maybe not the most beautiful tests, but they catch the issue with unresolved promises.