This commit is contained in:
parent
345a9efbc2
commit
451c53f2cd
1 changed files with 26 additions and 2 deletions
|
@ -1,5 +1,29 @@
|
||||||
|
import BaseEntity from "../../src/contracts/BaseEntity";
|
||||||
|
import uuid from "uuid";
|
||||||
|
|
||||||
|
jest.mock("uuid", () => {
|
||||||
|
return {
|
||||||
|
v4: () => "uuidv4",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
jest.useFakeTimers();
|
||||||
|
|
||||||
describe('constructor', () => {
|
describe('constructor', () => {
|
||||||
test.todo("EXPECT properties to be set");
|
test("EXPECT properties to be set", () => {
|
||||||
|
// Arrange
|
||||||
|
const systemTime = new Date("2024-06-29T00:00:00.000Z");
|
||||||
|
|
||||||
|
jest.setSystemTime(systemTime);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const entity = new BaseEntity();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(entity.Id).toBe("uuidv4");
|
||||||
|
expect(entity.WhenCreated).toStrictEqual(systemTime);
|
||||||
|
expect(entity.WhenUpdated).toStrictEqual(systemTime);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Save", () => {
|
describe("Save", () => {
|
||||||
|
|
Loading…
Reference in a new issue