import "reflect-metadata"; import {expect} from "chai"; import {Connection} from "../../../../src/connection/Connection"; import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils"; import {Post} from "./entity/Post"; describe("table inheritance > regular inheritance using extends keyword", () => { let connections: Connection[]; before(async () => connections = await createTestingConnections({ entities: [__dirname + "/entity/*{.js,.ts}"], })); beforeEach(() => reloadTestingDatabases(connections)); after(() => closeTestingConnections(connections)); it("should work correctly", () => Promise.all(connections.map(async connection => { const post = new Post(); post.name = "Super title"; post.text = "About this post"; await connection.manager.save(post); const loadedPost = await connection .manager .createQueryBuilder(Post, "post") .where("post.id = :id", { id: 1 }) .getOne(); expect(loadedPost).not.to.be.empty; expect(loadedPost!.name).not.to.be.empty; expect(loadedPost!.text).not.to.be.empty; loadedPost!.name.should.be.equal("Super title"); loadedPost!.text.should.be.equal("About this post"); }))); });