import { expectTypeOf } from "expect-type"; import { Primitives } from "../src"; import { ISODateTime } from "../src/Primitives"; import { Course } from "./Course"; import { DeliveryInfo } from "./DeliveryInfo"; import { Learner } from "./Learner"; import { Metadata } from "./Metadata"; import { Product } from "./Product"; import { Step } from "./Step"; import { User } from "./User"; import { Video } from "./Video"; describe("Primitives", () => { it("should ensure to only return primitive properties excluding methods", () => { type actualPrimitives = Primitives; type expectedPrimitives = { readonly courseId: string; }; expectTypeOf().toEqualTypeOf(); }); it("should get primitive array type from value object array", () => { type actualPrimitives = Primitives; type expectedPrimitives = { readonly enrolledCourses: string[]; }; expectTypeOf().toEqualTypeOf(); }); it("should generate nested primitive object", () => { type actualPrimitives = Primitives; type expectedPrimitives = { readonly address: { readonly city: string; readonly street: string; readonly number: number; }; }; expectTypeOf().toEqualTypeOf(); }); it("should generate nested primitive type from array of value objects prop", () => { type actualPrimitives = Primitives; type expectedPrimitives = { readonly addresses: { readonly city: string; readonly street: string; readonly number: number; }[]; }; expectTypeOf().toEqualTypeOf(); }); it("should get primitive type in case it is not a value object", () => { type actualPrimitives = Primitives; type expectedPrimitives = { readonly active: boolean; readonly name: string; }; expectTypeOf().toEqualTypeOf(); }); it("should get primitive ISO string type from Date", () => { type actualPrimitives = Primitives; type expectedPrimitives = { readonly name: string; readonly publishedAt: ISODateTime; }; expectTypeOf().toEqualTypeOf(); }); it("should infer the optional properties", () => { type actualPrimitives = Primitives