added tests for document flow