forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
issue-6327.ts
31 lines (22 loc) · 1.19 KB
/
issue-6327.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
31
import "reflect-metadata";
import { createTestingConnections, closeTestingConnections, reloadTestingDatabases } from "../../utils/test-utils";
import { Connection } from "../../../src/connection/Connection";
import { Post } from "./entity/Post";
describe("github issues > #6327 softRemove DeleteDateColumn is null at Susbscriber's AfterUpdate method", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
subscribers: [__dirname + "/subscriber/*{.js,.ts}"],
schemaCreate: true,
dropSchema: true,
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
it("should send correct update and delete date columns to after update subscriber", () => Promise.all(connections.map(async connection => {
const manager = connection.manager;
const entity = new Post();
await manager.save(entity);
const deletedEntity = await manager.softRemove(entity, { data: { action: "soft-delete" } });
await manager.recover(deletedEntity, { data: { action: "restore" } });
})));
});