added tests for conditions under which a new document is created