vylbot-app/tests/contracts/BaseEntity.test.ts

54 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2024-06-29 09:26:17 +01:00
import BaseEntity from "../../src/contracts/BaseEntity";
import uuid from "uuid";
jest.mock("uuid", () => {
return {
v4: () => "uuidv4",
};
});
jest.useFakeTimers();
2024-02-03 19:29:28 +00:00
describe('constructor', () => {
2024-06-29 09:26:17 +01:00
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);
});
2024-02-03 19:29:28 +00:00
});
describe("Save", () => {
test.todo("EXPECT entity to be saved");
});
describe("Remove", () => {
test.todo("EXPECT entity to be removed");
});
describe("FetchAll", () => {
test.todo("EXPECT all entities to be returned");
test.todo("GIVEN relations parameter is not supplied, EXPECT relations to be defaulted");
});
describe("FetchOneById", () => {
test.todo("EXPECT one entity to be returned");
test.todo("GIVEN relations parameter is not supplied, EXPECT relations to be defaulted");
});
describe("Any", () => {
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");
2024-06-29 09:26:17 +01:00
});