promisified version on train, with test and docs

test lib mocha