From d106eed439709d3317c02d11214bde1737ed5954 Mon Sep 17 00:00:00 2001 From: "Oleg \"OSA413\" Sokolov" Date: Tue, 10 Dec 2024 12:34:24 +0500 Subject: [PATCH 1/4] test: Add GitHub Actions for tests CI/CD (#11157) --- .github/workflows/test.yml | 170 ++++++++++++++++++ .../workflows/test/cockroachdb.docker-compose | 8 + .../workflows/test/cockroachdb.ormconfig.json | 24 +++ .github/workflows/test/mongodb.ormconfig.json | 26 +++ .github/workflows/test/mssql.ormconfig.json | 28 +++ .../test/mysql-mariadb.ormconfig.json | 36 ++++ .github/workflows/test/oracle.docker-compose | 13 ++ .github/workflows/test/oracle.ormconfig.json | 28 +++ .../workflows/test/postgres.ormconfig.json | 13 ++ ...sqlite-better-sqlite3-sqljs.ormconfig.json | 35 ++++ 10 files changed, 381 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/test/cockroachdb.docker-compose create mode 100644 .github/workflows/test/cockroachdb.ormconfig.json create mode 100644 .github/workflows/test/mongodb.ormconfig.json create mode 100644 .github/workflows/test/mssql.ormconfig.json create mode 100644 .github/workflows/test/mysql-mariadb.ormconfig.json create mode 100644 .github/workflows/test/oracle.docker-compose create mode 100644 .github/workflows/test/oracle.ormconfig.json create mode 100644 .github/workflows/test/postgres.ormconfig.json create mode 100644 .github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..1ced66ab61 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,170 @@ +# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs +# https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-nodejs +# https://docs.github.com/en/actions/use-cases-and-examples/using-containerized-services/creating-postgresql-service-containers + +name: test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + cockroachdb: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [18.x] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{matrix.node-version}} + - uses: actions/checkout@v4 + - run: docker compose -f .github/workflows/test/cockroachdb.docker-compose up -d + - run: npm i + - run: cp .github/workflows/test/cockroachdb.ormconfig.json ormconfig.json + - run: npm test + + + mongodb: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + container: ${{ matrix.node-container }} + services: + mongodb: + image: mongo:5.0.12 + + steps: + - uses: actions/checkout@v4 + - run: npm i + - run: cp .github/workflows/test/mongodb.ormconfig.json ormconfig.json + - run: npm test + + + mssql: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + container: ${{ matrix.node-container }} + services: + mssql: + image: "mcr.microsoft.com/mssql/server:2022-latest" + env: + SA_PASSWORD: "Admin12345" + ACCEPT_EULA: "Y" + + steps: + - uses: actions/checkout@v4 + - run: npm i + - run: cp .github/workflows/test/mssql.ormconfig.json ormconfig.json + - run: npm test + + + mysql_mariadb: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + container: ${{ matrix.node-container }} + services: + mysql: + image: mysql:5.7.37 + env: + MYSQL_ROOT_PASSWORD: "admin" + MYSQL_USER: "test" + MYSQL_PASSWORD: "test" + MYSQL_DATABASE: "test" + mariadb: + image: mariadb:10.10.3 + env: + MYSQL_ROOT_PASSWORD: "admin" + MYSQL_USER: "test" + MYSQL_PASSWORD: "test" + MYSQL_DATABASE: "test" + + steps: + - uses: actions/checkout@v4 + - run: npm i + - run: cp .github/workflows/test/mysql-mariadb.ormconfig.json ormconfig.json + - run: npm test + + + oracle: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [18.x] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{matrix.node-version}} + - uses: actions/checkout@v4 + - run: docker compose -f .github/workflows/test/oracle.docker-compose up -d + - run: npm i + - run: cp .github/workflows/test/oracle.ormconfig.json ormconfig.json + - run: npm test + + + sqlite_better-sqlite3_sqljs: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + container: ${{ matrix.node-container }} + + steps: + - uses: actions/checkout@v4 + - run: npm i + - run: cp .github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json ormconfig.json + - run: npm test + + + posgres: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + container: ${{ matrix.node-container }} + services: + postgres: + image: postgis/postgis:14-3.3 + env: + POSTGRES_USERNAME: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v4 + - run: npm i + - run: cp .github/workflows/test/postgres.ormconfig.json ormconfig.json + - run: npm test diff --git a/.github/workflows/test/cockroachdb.docker-compose b/.github/workflows/test/cockroachdb.docker-compose new file mode 100644 index 0000000000..448ca832c3 --- /dev/null +++ b/.github/workflows/test/cockroachdb.docker-compose @@ -0,0 +1,8 @@ +version: "3" +services: + cockroachdb: + image: "cockroachdb/cockroach:v23.1.9" + container_name: "typeorm-cockroachdb" + command: start-single-node --insecure --cache=0.75 --store=type=mem,size=0.75 + ports: + - "26257:26257" diff --git a/.github/workflows/test/cockroachdb.ormconfig.json b/.github/workflows/test/cockroachdb.ormconfig.json new file mode 100644 index 0000000000..e9501327a6 --- /dev/null +++ b/.github/workflows/test/cockroachdb.ormconfig.json @@ -0,0 +1,24 @@ +[ + { + "skip": false, + "name": "cockroachdb", + "type": "cockroachdb", + "host": "localhost", + "port": 26257, + "username": "root", + "password": "", + "database": "defaultdb" + }, + + { + "skip": true, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] diff --git a/.github/workflows/test/mongodb.ormconfig.json b/.github/workflows/test/mongodb.ormconfig.json new file mode 100644 index 0000000000..c03c017646 --- /dev/null +++ b/.github/workflows/test/mongodb.ormconfig.json @@ -0,0 +1,26 @@ +[ + { + "skip": false, + "disabledIfNotEnabledImplicitly": true, + "name": "mongodb", + "type": "mongodb", + "host": "mongodb", + "port": 27017, + "database": "test", + "logging": false, + "useNewUrlParser": true, + "useUnifiedTopology": true + }, + + { + "skip": true, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] diff --git a/.github/workflows/test/mssql.ormconfig.json b/.github/workflows/test/mssql.ormconfig.json new file mode 100644 index 0000000000..570bee1276 --- /dev/null +++ b/.github/workflows/test/mssql.ormconfig.json @@ -0,0 +1,28 @@ +[ + { + "skip": false, + "name": "mssql", + "type": "mssql", + "host": "mssql", + "port": 1433, + "username": "sa", + "password": "Admin12345", + "database": "tempdb", + "logging": false, + "extra": { + "trustServerCertificate": true + } + }, + + { + "skip": true, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] diff --git a/.github/workflows/test/mysql-mariadb.ormconfig.json b/.github/workflows/test/mysql-mariadb.ormconfig.json new file mode 100644 index 0000000000..9b06509d52 --- /dev/null +++ b/.github/workflows/test/mysql-mariadb.ormconfig.json @@ -0,0 +1,36 @@ +[ + { + "skip": false, + "name": "mysql", + "type": "mysql", + "host": "mysql", + "port": 3306, + "username": "root", + "password": "admin", + "database": "test", + "logging": false + }, + { + "skip": false, + "name": "mariadb", + "type": "mariadb", + "host": "mariadb", + "port": 3306, + "username": "root", + "password": "admin", + "database": "test", + "logging": false + }, + + { + "skip": true, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] diff --git a/.github/workflows/test/oracle.docker-compose b/.github/workflows/test/oracle.docker-compose new file mode 100644 index 0000000000..2f79eab314 --- /dev/null +++ b/.github/workflows/test/oracle.docker-compose @@ -0,0 +1,13 @@ +version: "3" +services: + oracle: + build: + context: ../../../docker/oracle + container_name: "typeorm-oracle" + ports: + - "1521:1521" + #volumes: + # - oracle-data:/opt/oracle/oradata + healthcheck: + test: [ "CMD", "/opt/oracle/checkDBStatus.sh" ] + interval: 2s \ No newline at end of file diff --git a/.github/workflows/test/oracle.ormconfig.json b/.github/workflows/test/oracle.ormconfig.json new file mode 100644 index 0000000000..9bf120d624 --- /dev/null +++ b/.github/workflows/test/oracle.ormconfig.json @@ -0,0 +1,28 @@ +[ + { + "skip": false, + "name": "oracle", + "type": "oracle", + "host": "localhost", + "port": 1521, + "serviceName": "XEPDB1", + "username": "typeorm", + "password": "oracle", + "logging": false, + "extra": { + "connectString": "localhost:1521/XEPDB1" + } + }, + + { + "skip": true, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] diff --git a/.github/workflows/test/postgres.ormconfig.json b/.github/workflows/test/postgres.ormconfig.json new file mode 100644 index 0000000000..dd20cd4c08 --- /dev/null +++ b/.github/workflows/test/postgres.ormconfig.json @@ -0,0 +1,13 @@ +[ + { + "skip": false, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] diff --git a/.github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json b/.github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json new file mode 100644 index 0000000000..47510470a4 --- /dev/null +++ b/.github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json @@ -0,0 +1,35 @@ +[ + { + "skip": false, + "name": "sqljs", + "type": "sqljs", + "logging": false + }, + { + "skip": false, + "name": "sqlite", + "type": "sqlite", + "database": "./temp/sqlitedb-1.db", + "logging": false, + "relationLoadStrategy": "join" + }, + { + "skip": false, + "name": "better-sqlite3", + "type": "better-sqlite3", + "database": "temp/better-sqlite3db.db", + "logging": false + }, + + { + "skip": true, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] From f6a94ddcfcbe0b9fbb07395861feb216689c6856 Mon Sep 17 00:00:00 2001 From: "Oleg \"OSA413\" Sokolov" Date: Tue, 10 Dec 2024 19:54:02 +0500 Subject: [PATCH 2/4] test: remove restriction of CI/CD runs for fork branches (#11173) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1ced66ab61..ceed57a58f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ name: test on: push: - branches: [ "master" ] + branches: [ "**" ] pull_request: branches: [ "master" ] From 5c2330adc1935e10a741fe2c79381520ebe7bc95 Mon Sep 17 00:00:00 2001 From: "Oleg \"OSA413\" Sokolov" Date: Wed, 11 Dec 2024 02:14:13 +0500 Subject: [PATCH 3/4] test: Split SQLite tests and fix better-sqlite3 (#11174) --- .github/workflows/test.yml | 38 ++++++++++++++++++- .../test/better-sqlite3.ormconfig.json | 21 ++++++++++ ...s.ormconfig.json => sqlite.ormconfig.json} | 13 ------- .github/workflows/test/sqljs.ormconfig.json | 20 ++++++++++ .../BetterSqlite3QueryRunner.ts | 18 +++++++++ 5 files changed, 95 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/test/better-sqlite3.ormconfig.json rename .github/workflows/test/{sqlite-better-sqlite3-sqljs.ormconfig.json => sqlite.ormconfig.json} (61%) create mode 100644 .github/workflows/test/sqljs.ormconfig.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ceed57a58f..c4ba021d0b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -124,7 +124,7 @@ jobs: - run: npm test - sqlite_better-sqlite3_sqljs: + better-sqlite3: runs-on: ubuntu-latest strategy: fail-fast: false @@ -137,7 +137,41 @@ jobs: steps: - uses: actions/checkout@v4 - run: npm i - - run: cp .github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json ormconfig.json + - run: cp .github/workflows/test/better-sqlite3.ormconfig.json ormconfig.json + - run: npm test + + + sqlite: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + container: ${{ matrix.node-container }} + + steps: + - uses: actions/checkout@v4 + - run: npm i + - run: cp .github/workflows/test/sqlite.ormconfig.json ormconfig.json + - run: npm test + + + sqljs: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + container: ${{ matrix.node-container }} + + steps: + - uses: actions/checkout@v4 + - run: npm i + - run: cp .github/workflows/test/sqljs.ormconfig.json ormconfig.json - run: npm test diff --git a/.github/workflows/test/better-sqlite3.ormconfig.json b/.github/workflows/test/better-sqlite3.ormconfig.json new file mode 100644 index 0000000000..63836497d5 --- /dev/null +++ b/.github/workflows/test/better-sqlite3.ormconfig.json @@ -0,0 +1,21 @@ +[ + { + "skip": false, + "name": "better-sqlite3", + "type": "better-sqlite3", + "database": "temp/better-sqlite3db.db", + "logging": false + }, + + { + "skip": true, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] diff --git a/.github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json b/.github/workflows/test/sqlite.ormconfig.json similarity index 61% rename from .github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json rename to .github/workflows/test/sqlite.ormconfig.json index 47510470a4..55a30706a8 100644 --- a/.github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json +++ b/.github/workflows/test/sqlite.ormconfig.json @@ -1,10 +1,4 @@ [ - { - "skip": false, - "name": "sqljs", - "type": "sqljs", - "logging": false - }, { "skip": false, "name": "sqlite", @@ -13,13 +7,6 @@ "logging": false, "relationLoadStrategy": "join" }, - { - "skip": false, - "name": "better-sqlite3", - "type": "better-sqlite3", - "database": "temp/better-sqlite3db.db", - "logging": false - }, { "skip": true, diff --git a/.github/workflows/test/sqljs.ormconfig.json b/.github/workflows/test/sqljs.ormconfig.json new file mode 100644 index 0000000000..897ada4114 --- /dev/null +++ b/.github/workflows/test/sqljs.ormconfig.json @@ -0,0 +1,20 @@ +[ + { + "skip": false, + "name": "sqljs", + "type": "sqljs", + "logging": false + }, + + { + "skip": true, + "name": "postgres", + "type": "postgres", + "host": "postgres", + "port": 5432, + "username": "postgres", + "password": "postgres", + "database": "postgres", + "logging": false + } +] diff --git a/src/driver/better-sqlite3/BetterSqlite3QueryRunner.ts b/src/driver/better-sqlite3/BetterSqlite3QueryRunner.ts index d7fcc8adaa..5375fa5ecd 100644 --- a/src/driver/better-sqlite3/BetterSqlite3QueryRunner.ts +++ b/src/driver/better-sqlite3/BetterSqlite3QueryRunner.ts @@ -4,6 +4,7 @@ import { AbstractSqliteQueryRunner } from "../sqlite-abstract/AbstractSqliteQuer import { Broadcaster } from "../../subscriber/Broadcaster" import { BetterSqlite3Driver } from "./BetterSqlite3Driver" import { QueryResult } from "../../query-runner/QueryResult" +import { BroadcasterResult } from "../../subscriber/BroadcasterResult" /** * Runs queries on a single sqlite database connection. @@ -83,7 +84,14 @@ export class BetterSqlite3QueryRunner extends AbstractSqliteQueryRunner { const connection = this.driver.connection + const broadcasterResult = new BroadcasterResult() + this.driver.connection.logger.logQuery(query, parameters, this) + this.broadcaster.broadcastBeforeQueryEvent( + broadcasterResult, + query, + parameters, + ) const queryStartTime = +new Date() const stmt = await this.getStmt(query) @@ -121,6 +129,16 @@ export class BetterSqlite3QueryRunner extends AbstractSqliteQueryRunner { this, ) + this.broadcaster.broadcastAfterQueryEvent( + broadcasterResult, + query, + parameters, + true, + queryExecutionTime, + result.raw, + undefined, + ) + if (!useStructuredResult) { return result.raw } From b535cbd1bf590b7ecca1759f4aecbb62175d4685 Mon Sep 17 00:00:00 2001 From: "Oleg \"OSA413\" Sokolov" Date: Wed, 11 Dec 2024 13:51:02 +0500 Subject: [PATCH 4/4] style: Apply formatting (#11175) --- src/driver/postgres/PostgresQueryRunner.ts | 20 ++++++++++++++++---- src/query-builder/InsertQueryBuilder.ts | 6 ++---- src/query-builder/QueryBuilder.ts | 5 ++++- src/schema-builder/RdbmsSchemaBuilder.ts | 2 +- test/integration/sample2-one-to-one.ts | 11 ++++++----- test/integration/sample3-many-to-one.ts | 21 +++++++++++---------- 6 files changed, 40 insertions(+), 25 deletions(-) diff --git a/src/driver/postgres/PostgresQueryRunner.ts b/src/driver/postgres/PostgresQueryRunner.ts index fae9704985..481cf4943c 100644 --- a/src/driver/postgres/PostgresQueryRunner.ts +++ b/src/driver/postgres/PostgresQueryRunner.ts @@ -601,10 +601,22 @@ export class PostgresQueryRunner downQueries.push(this.dropIndexSql(table, index)) }) } - + if (table.comment) { - upQueries.push(new Query("COMMENT ON TABLE " + this.escapePath(table) + " IS '" + table.comment + "'")); - downQueries.push(new Query("COMMENT ON TABLE " + this.escapePath(table) + " IS NULL")); + upQueries.push( + new Query( + "COMMENT ON TABLE " + + this.escapePath(table) + + " IS '" + + table.comment + + "'", + ), + ) + downQueries.push( + new Query( + "COMMENT ON TABLE " + this.escapePath(table) + " IS NULL", + ), + ) } await this.executeQueries(upQueries, downQueries) @@ -4744,7 +4756,7 @@ export class PostgresQueryRunner newComment = this.escapeComment(newComment) const comment = this.escapeComment(table.comment) - + if (newComment === comment) { return } diff --git a/src/query-builder/InsertQueryBuilder.ts b/src/query-builder/InsertQueryBuilder.ts index 1acc3304ac..52a906f789 100644 --- a/src/query-builder/InsertQueryBuilder.ts +++ b/src/query-builder/InsertQueryBuilder.ts @@ -459,10 +459,8 @@ export class InsertQueryBuilder< // add VALUES expression if (valuesExpression) { if ( - ( - this.connection.driver.options.type === "oracle" || - this.connection.driver.options.type === "sap" - ) && + (this.connection.driver.options.type === "oracle" || + this.connection.driver.options.type === "sap") && this.getValueSets().length > 1 ) { query += ` ${valuesExpression}` diff --git a/src/query-builder/QueryBuilder.ts b/src/query-builder/QueryBuilder.ts index 289f3e3d04..8953cd895f 100644 --- a/src/query-builder/QueryBuilder.ts +++ b/src/query-builder/QueryBuilder.ts @@ -522,7 +522,10 @@ export abstract class QueryBuilder { * Uses same query runner as current QueryBuilder. */ createQueryBuilder(queryRunner?: QueryRunner): this { - return new (this.constructor as any)(this.connection, queryRunner ?? this.queryRunner) + return new (this.constructor as any)( + this.connection, + queryRunner ?? this.queryRunner, + ) } /** diff --git a/src/schema-builder/RdbmsSchemaBuilder.ts b/src/schema-builder/RdbmsSchemaBuilder.ts index 9b22d95358..1f5460e3f5 100644 --- a/src/schema-builder/RdbmsSchemaBuilder.ts +++ b/src/schema-builder/RdbmsSchemaBuilder.ts @@ -604,7 +604,7 @@ export class RdbmsSchemaBuilder implements SchemaBuilder { if ( DriverUtils.isMySQLFamily(this.connection.driver) || - this.connection.driver.options.type === 'postgres' + this.connection.driver.options.type === "postgres" ) { const newComment = metadata.comment await this.queryRunner.changeTableComment(table, newComment) diff --git a/test/integration/sample2-one-to-one.ts b/test/integration/sample2-one-to-one.ts index ce780e3d78..24f18452d2 100644 --- a/test/integration/sample2-one-to-one.ts +++ b/test/integration/sample2-one-to-one.ts @@ -211,14 +211,15 @@ describe("one-to-one", function () { expectedPost.details!.comment = savedPost.details!.comment expectedPost.details!.metadata = savedPost.details!.metadata - const findOne = () => postRepository.findOne({ + const findOne = () => + postRepository.findOne({ where: { - id: savedPost.id + id: savedPost.id, }, relations: { - details: true + details: true, }, - relationLoadStrategy: "query" + relationLoadStrategy: "query", }) const posts = await Promise.all([ @@ -234,7 +235,7 @@ describe("one-to-one", function () { findOne(), ]) - posts.forEach(post => { + posts.forEach((post) => { expect(post).not.to.be.null post!.should.eql(expectedPost) }) diff --git a/test/integration/sample3-many-to-one.ts b/test/integration/sample3-many-to-one.ts index b6b4783eb1..a2f0580547 100644 --- a/test/integration/sample3-many-to-one.ts +++ b/test/integration/sample3-many-to-one.ts @@ -213,15 +213,16 @@ describe("many-to-one", function () { expectedPost.details!.comment = savedPost.details!.comment expectedPost.details!.metadata = savedPost.details!.metadata - const findOne = () => postRepository.findOne({ - where: { - id: savedPost.id - }, - relations: { - details: true - }, - relationLoadStrategy: "query" - }) + const findOne = () => + postRepository.findOne({ + where: { + id: savedPost.id, + }, + relations: { + details: true, + }, + relationLoadStrategy: "query", + }) const posts = await Promise.all([ findOne(), @@ -236,7 +237,7 @@ describe("many-to-one", function () { findOne(), ]) - posts.forEach(post => { + posts.forEach((post) => { expect(post).not.to.be.null post!.should.eql(expectedPost) })