vylbot-app/tests/contracts/BaseEntity.test.ts
Ethan Lane 451c53f2cd
All checks were successful
Test / build (push) Successful in 16s
WIP: Start of basentity tests
2024-06-29 09:26:17 +01:00

54 lines
1.3 KiB
TypeScript

import BaseEntity from "../../src/contracts/BaseEntity";
import uuid from "uuid";
jest.mock("uuid", () => {
return {
v4: () => "uuidv4",
};
});
jest.useFakeTimers();
describe('constructor', () => {
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", () => {
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");
});