diff --git a/test/functional/mongodb/basic/mongo-repository/mongo-repository.ts b/test/functional/mongodb/basic/mongo-repository/mongo-repository.ts index 3d229cd2368..e030381147f 100644 --- a/test/functional/mongodb/basic/mongo-repository/mongo-repository.ts +++ b/test/functional/mongodb/basic/mongo-repository/mongo-repository.ts @@ -87,5 +87,29 @@ describe("mongodb > MongoRepository", () => { }))); // todo: cover other methods as well + it("should be able to save and update mongo entities", () => Promise.all(connections.map(async connection => { + const postRepository = connection.getMongoRepository(Post); + + // save few posts + const firstPost = new Post(); + firstPost.title = "Post #1"; + firstPost.text = "Everything about post #1"; + await postRepository.save(firstPost); + + const secondPost = new Post(); + secondPost.title = "Post #2"; + secondPost.text = "Everything about post #2"; + await postRepository.save(secondPost); + // save few posts + firstPost.text = "Everything and more about post #1"; + await postRepository.save(firstPost); + + const loadedPosts = await postRepository.find(); + + loadedPosts.length.should.be.equal(2); + loadedPosts[0].text.should.be.equal("Everything and more about post #1"); + loadedPosts[0].text.should.be.equal("Everything about post #2"); + + }))); });