Repository: typeorm/typeorm
File: test/other-issues/lazy-count/lazy-count.ts (TypeScript)

Code before:
        Promise.all(
            connections.map(async function (connection) {
                await savePostEntities(connection, 5)

                const afterQuery = connection
                    .subscribers[0] as AfterQuerySubscriber
                afterQuery.clear()

                const [entities, count] = await connection.manager
                    .createQueryBuilder(Post, "post")
                    .limit(10)
                    .orderBy("post.id")
                    .getManyAndCount()

                expect(count).to.be.equal(5)
                expect(entities.length).to.be.equal(5)

                expect(
                    afterQuery
                        .getCalledQueries()
                        .filter((query) => query.match(/(count|cnt)/i)),
                ).to.be.empty
            }),
        ))

    it("skip count query when less entities are returned than the take", () =>
        Promise.all(
            connections.map(async function (connection) {
                await savePostEntities(connection, 5)

                const afterQuery = connection
                    .subscribers[0] as AfterQuerySubscriber
                afterQuery.clear()

                const [entities, count] = await connection.manager
                    .createQueryBuilder(Post, "post")
                    .take(10)
                    .orderBy("post.id")
                    .getManyAndCount()

                expect(count).to.be.equal(5)
                expect(entities.length).to.be.equal(5)

                expect(
                    afterQuery
                        .getCalledQueries()
                        .filter((query) => query.match(/(count|cnt)/i)),
                ).to.be.empty
            }),
        ))


Review comment (suggestion):
```suggestion
    it("skip count query when fewer entities are returned than the take", () =>
```

Code after:
        Promise.all(
            connections.map(async function (connection) {
                await savePostEntities(connection, 5)

                const afterQuery = connection
                    .subscribers[0] as AfterQuerySubscriber
                afterQuery.clear()

                const [entities, count] = await connection.manager
                    .createQueryBuilder(Post, "post")
                    .limit(10)
                    .orderBy("post.id")
                    .getManyAndCount()

                expect(count).to.be.equal(5)
                expect(entities.length).to.be.equal(5)

                expect(
                    afterQuery
                        .getCalledQueries()
                        .filter((query) => query.match(/(count|cnt)/i)),
                ).to.be.empty
            }),
        ))

    it("skip count query when fewer entities are returned than the take", () =>
        Promise.all(
            connections.map(async function (connection) {
                await savePostEntities(connection, 5)

                const afterQuery = connection
                    .subscribers[0] as AfterQuerySubscriber
                afterQuery.clear()

                const [entities, count] = await connection.manager
                    .createQueryBuilder(Post, "post")
                    .take(10)
                    .orderBy("post.id")
                    .getManyAndCount()

                expect(count).to.be.equal(5)
                expect(entities.length).to.be.equal(5)

                expect(
                    afterQuery
                        .getCalledQueries()
                        .filter((query) => query.match(/(count|cnt)/i)),
                ).to.be.empty
            }),
        ))