-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8c625d
commit 2131016
Showing
1 changed file
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import "reflect-metadata"; | ||
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../utils/test-utils"; | ||
import {Connection} from "../../../src/connection/Connection"; | ||
import {expect} from "chai"; | ||
import { Table } from '../../../src'; | ||
import { xfail } from "../../utils/xfail"; | ||
|
||
describe("github issues > #3387 named columns", () => { | ||
|
||
let connections: Connection[]; | ||
before(async () => connections = await createTestingConnections({ | ||
entities: [__dirname + "/entity/*{.js,.ts}"], | ||
enabledDrivers: ["postgres"] | ||
})); | ||
beforeEach(() => reloadTestingDatabases(connections)); | ||
after(() => closeTestingConnections(connections)); | ||
|
||
xfail | ||
.unless(() => connections.length > 0) | ||
.it("should allow inserting named columns", () => Promise.all(connections.map(async connection => { | ||
|
||
// Create the categories table. | ||
const qr = connection.createQueryRunner(); | ||
await qr.createTable(new Table({ | ||
name: 'category', | ||
columns: [ | ||
{ | ||
name: "id", | ||
type: "int", | ||
isPrimary: true, | ||
isGenerated: true, | ||
generationStrategy: "increment" | ||
}, | ||
{ | ||
name: "name", | ||
type: "varchar", | ||
} | ||
] | ||
})); | ||
|
||
const insert = connection.manager.insert('category', [ | ||
{ name: 'Easy' }, | ||
{ name: 'Medium' }, | ||
{ name: 'Hard' }, | ||
]); | ||
|
||
return expect(insert).to.fulfilled | ||
}))); | ||
}); |