-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: stop dynamic importing of entities using the glob pattern (#71)
- Loading branch information
Showing
396 changed files
with
1,180 additions
and
1,540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {Entity} from "../../../../src/decorator/entity/Entity.ts"; | ||
import {PrimaryGeneratedColumn} from "../../../../src/decorator/columns/PrimaryGeneratedColumn.ts"; | ||
import {Column} from "../../../../src/decorator/columns/Column.ts"; | ||
import {Post} from "./Post.ts"; | ||
import {OneToMany} from "../../../../src/decorator/relations/OneToMany.ts"; | ||
|
||
@Entity() | ||
export class Category { | ||
|
||
@PrimaryGeneratedColumn() | ||
id!: number; | ||
|
||
@Column({ type: String }) | ||
name!: string; | ||
|
||
@OneToMany(() => Post, post => post.category, { lazy: true }) | ||
posts!: Promise<Post[]>; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {Entity} from "../../../../src/decorator/entity/Entity.ts"; | ||
import {PrimaryGeneratedColumn} from "../../../../src/decorator/columns/PrimaryGeneratedColumn.ts"; | ||
import {Column} from "../../../../src/decorator/columns/Column.ts"; | ||
import {Category} from "./Category.ts"; | ||
import {ManyToOne} from "../../../../src/decorator/relations/ManyToOne.ts"; | ||
|
||
@Entity() | ||
export class Post { | ||
|
||
@PrimaryGeneratedColumn() | ||
id!: number; | ||
|
||
@Column({ type: String }) | ||
title!: string; | ||
|
||
@ManyToOne(() => Category, category => category.posts, { | ||
cascade: ["insert"], | ||
lazy: true | ||
}) | ||
category!: Promise<Category>; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {join as joinPaths} from "../../../vendor/https/deno.land/std/path/mod.ts"; | ||
import {runIfMain} from "../../deps/mocha.ts"; | ||
import {expect} from "../../deps/chai.ts"; | ||
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../utils/test-utils.ts"; | ||
import {Connection} from "../../../src/connection/Connection.ts"; | ||
import {Post} from "./entity/Post.ts"; | ||
import {Category} from "./entity/Category.ts"; | ||
|
||
describe("denolib issues > #70 dynamic imports of entities using the glob pattern", () => { | ||
|
||
let connections: Connection[]; | ||
const __dirname = getDirnameOfCurrentModule(import.meta); | ||
before(async () => connections = await createTestingConnections({ | ||
entities: [joinPaths(__dirname, "/entity/*.ts")] | ||
})); | ||
beforeEach(() => reloadTestingDatabases(connections)); | ||
after(() => closeTestingConnections(connections)); | ||
|
||
it("should import entities that match the glob pattern", () => connections.map(connection => { | ||
expect(connection.entityMetadatas).to.have.lengthOf(2); | ||
expect(connection.entityMetadatas.find(x => x.target === Post)).not.to.be.undefined; | ||
expect(connection.entityMetadatas.find(x => x.target === Category)).not.to.be.undefined; | ||
})); | ||
}); | ||
|
||
runIfMain(import.meta); |
6 changes: 2 additions & 4 deletions
6
test/functional/cascades/cascade-insert-from-both-sides/cascade-insert-from-both-sides.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-collation/cockroach/column-collation-cockroach.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-collation/mssql/column-collation-mssql.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-collation/mysql/column-collation-mysql.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-collation/postgres/column-collation-postgres.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-collation/sqlite/column-collation-sqlite.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-types/cockroachdb/column-types-cockroach.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-types/mysql/column-types-mysql.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-types/oracle/column-types-oracle.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-types/postgres-enum/postgres-enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
test/functional/database-schema/column-types/postgres/column-types-postgres.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.