mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
added test (issue #423)
This commit is contained in:
parent
c5e3a27ac3
commit
06c2e46eb0
@ -344,7 +344,7 @@ export class Gulpfile {
|
||||
.pipe(mocha({
|
||||
bail: true,
|
||||
grep: !!args.grep ? new RegExp(args.grep) : undefined,
|
||||
timeout: 30000
|
||||
timeout: 15000
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
16
test/github-issues/423/entity/Group.ts
Normal file
16
test/github-issues/423/entity/Group.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import {Entity} from "../../../../src/decorator/entity/Entity";
|
||||
import {PrimaryColumn} from "../../../../src/decorator/columns/PrimaryColumn";
|
||||
import {Column} from "../../../../src/decorator/columns/Column";
|
||||
import {Index} from "../../../../src/decorator";
|
||||
|
||||
@Index("Groups name", ["name"], { unique: true })
|
||||
@Entity("groups")
|
||||
export class Group {
|
||||
|
||||
@PrimaryColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
name: string;
|
||||
|
||||
}
|
||||
30
test/github-issues/423/issue-423.ts
Normal file
30
test/github-issues/423/issue-423.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import "reflect-metadata";
|
||||
import {closeTestingConnections, createTestingConnections} from "../../utils/test-utils";
|
||||
import {Connection} from "../../../src/connection/Connection";
|
||||
|
||||
describe("github issues > #423 Cannot use Group as Table name && cannot autoSchemeSync when use alias Entity", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
entities: [__dirname + "/entity/*{.js,.ts}"],
|
||||
schemaCreate: false,
|
||||
dropSchema: true
|
||||
}));
|
||||
after(() => closeTestingConnections(connections));
|
||||
|
||||
it("should successfully sync schema", () => Promise.all(connections.map(async connection => {
|
||||
await connection.synchronize();
|
||||
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
const table = await queryRunner.getTable("groups");
|
||||
await queryRunner.release();
|
||||
|
||||
table!.should.exist;
|
||||
table!.indices.length.should.be.equal(1);
|
||||
table!.indices[0].name!.should.be.equal("Groups name");
|
||||
table!.indices[0].columnNames[0].should.be.equal("name");
|
||||
table!.indices[0].isUnique!.should.be.true;
|
||||
|
||||
})));
|
||||
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user