WIP: Start of basentity tests
All checks were successful
Test / build (push) Successful in 16s

This commit is contained in:
Ethan Lane 2024-06-29 09:26:17 +01:00
parent 345a9efbc2
commit 451c53f2cd

View file

@ -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", () => {
@ -26,4 +50,4 @@ describe("Any", () => {
test.todo("GIVEN at least 1 entity is found, EXPECT true to be returned"); test.todo("GIVEN at least 1 entity is found, EXPECT true to be returned");
test.todo("GIVEN no entities are found, EXPECT false to be returned"); test.todo("GIVEN no entities are found, EXPECT false to be returned");
}); });