Skip to content

Commit

Permalink
test: confirm #3387
Browse files Browse the repository at this point in the history
  • Loading branch information
clovis1122 authored and imnotjames committed Jul 27, 2021
1 parent f8c625d commit 2131016
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/github-issues/3387/issue-3387.ts
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
})));
});

0 comments on commit 2131016

Please sign in to comment.