test: use sinon stub to simplify code