Repository: typeorm/typeorm
File: test/functional/query-builder/select/query-builder-select.test.ts (TypeScript)

Code before:

                        expect(params).to.eql([])
                    }),
                ))
        })

        describe("many-to-many", () => {
            it("should craft query with exact value", () =>
                Promise.all(
                    connections.map(async (connection) => {
                        const [sql, params] = connection
                            .createQueryBuilder(Post, "post")
                            .select("post.id")
                            .leftJoin("post.tags", "tags_join")
                            .where({
                                tags: {
                                    name: "Foo",
                                },
                            })
                            .getQueryAndParameters()
                        expect(sql).to.equal(
                            'SELECT "post"."id" AS "post_id" FROM "post" "post" ' +
                                'LEFT JOIN "post_tags_tag" "post_tags_join" ON "post_tags_join"."postId"="post"."id" ' +
                                'LEFT JOIN "tag" "tags_join" ON "tags_join"."id"="post_tags_join"."tagId" ' +
                                'WHERE "tags_join"."name" = ?',
                        )

                        expect(params).to.eql(["Foo"])
                    }),
                ))

            it("should craft query with FindOperator", () =>
                Promise.all(
                    connections.map(async (connection) => {
                        const [sql, params] = connection
                            .createQueryBuilder(Post, "post")
                            .select("post.id")
                            .leftJoin("post.tags", "tags_join")
                            .where({
                                tags: {
                                    name: IsNull(),
                                },
                            })
                            .getQueryAndParameters()
                        expect(sql).to.equal(
                            'SELECT "post"."id" AS "post_id" FROM "post" "post" ' +
                                'LEFT JOIN "post_tags_tag" "post_tags_join" ON "post_tags_join"."postId"="post"."id" ' +
                                'LEFT JOIN "tag" "tags_join" ON "tags_join"."id"="post_tags_join"."tagId" ' +
                                'WHERE "tags_join"."name" IS NULL',
                        )


Review comment (bug):
The tests are failing because this test uses a DB-specific parameter, this should be avoided/improved.

Code after:
                        )

                        expect(params).to.eql([])
                    }),
                ))
        })

        describe("many-to-many", () => {
            it("should craft query with exact value", () =>
                Promise.all(
                    connections.map(async (connection) => {
                        const [sql, params] = connection
                            .createQueryBuilder(Post, "post")
                            .select("post.id")
                            .leftJoin("post.tags", "tags_join")
                            .where({
                                tags: {
                                    name: "Foo",
                                },
                            })
                            .getQueryAndParameters()
                        expect(sql).to.equal(
                            'SELECT "post"."id" AS "post_id" FROM "post" "post" ' +
                                'LEFT JOIN "post_tags_tag" "post_tags_join" ON "post_tags_join"."postId"="post"."id" ' +
                                'LEFT JOIN "tag" "tags_join" ON "tags_join"."id"="post_tags_join"."tagId" ' +
                                'WHERE "tags_join"."name" = ?',
                        )

                        expect(params).to.eql(["Foo"])
                    }),
                ))

            it("should craft query with FindOperator", () =>
                Promise.all(
                    connections.map(async (connection) => {
                        const [sql, params] = connection
                            .createQueryBuilder(Post, "post")
                            .select("post.id")
                            .leftJoin("post.tags", "tags_join")
                            .where({
                                tags: {
                                    name: IsNull(),
                                },
                            })
                            .getQueryAndParameters()
                        expect(sql).to.equal(
                            'SELECT "post"."id" AS "post_id" FROM "post" "post" ' +
                                'LEFT JOIN "post_tags_tag" "post_tags_join" ON "post_tags_join"."postId"="post"."id" ' +
                                'LEFT JOIN "tag" "tags_join" ON "tags_join"."id"="post_tags_join"."tagId" ' +
                                'WHERE "tags_join"."name" IS NULL',
                        )