add unit test for then()
fixes #4