forked from typeorm/typeorm
/
issue-3874.ts
30 lines (26 loc) · 1.25 KB
/
issue-3874.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import "reflect-metadata";
import {createTestingConnections, closeTestingConnections, reloadTestingDatabases} from "../../utils/test-utils";
import {Connection} from "../../../src/connection/Connection";
import {Settings} from "./entity/Settings";
import {expect} from "chai";
describe("github issues > #3874 Using an (empty string) enum as the type of a primary key column", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [Settings],
enabledDrivers: ["mysql", "mariadb"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
it("should reload entity", () => Promise.all(connections.map(async connection => {
// Create initial settings row
const newSettings = new Settings();
newSettings.value = "string";
await connection.manager.save(newSettings);
// Attempt to read settings back
const foundSettings = await connection.manager.findOne(Settings);
expect(foundSettings).to.be.an.instanceOf(Settings);
expect(foundSettings != null ? foundSettings.value : null).to.equal("string");
})));
});