From 32cebaf6bf8a620f7ca98e519454d8a510ffb909 Mon Sep 17 00:00:00 2001 From: arnold Date: Thu, 9 Feb 2023 17:10:09 +0100 Subject: [PATCH 1/5] test: add more test scenarios --- tests/Primitives.test.ts | 27 ++++++++++++++++++++++++++- tests/Product.ts | 15 +++++++++++++++ tests/Video.ts | 19 +++++++++++++++++++ tests/VideoId.ts | 3 +++ tests/VideoName.ts | 3 +++ 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tests/Product.ts create mode 100644 tests/Video.ts create mode 100644 tests/VideoId.ts create mode 100644 tests/VideoName.ts diff --git a/tests/Primitives.test.ts b/tests/Primitives.test.ts index 57ae183..196e383 100644 --- a/tests/Primitives.test.ts +++ b/tests/Primitives.test.ts @@ -1,10 +1,12 @@ import { expectTypeOf } from "expect-type"; -import { Primitives } from "../src/Primitives"; +import { Primitives } from "../src"; import { Course } from "./Course"; import { DeliveryInfo } from "./DeliveryInfo"; import { Learner } from "./Learner"; +import { Product } from "./Product"; import { User } from "./User"; +import { Video } from "./Video"; describe("Primitives", () => { it("should ensure to only return primitive properties excluding methods", () => { @@ -52,4 +54,27 @@ describe("Primitives", () => { expectTypeOf().toEqualTypeOf(); }); + + it("should get primitive type in case it is not a value object", () => { + type actualPrimitives = Primitives; + + type expectedPrimitives = { + readonly active: boolean; + readonly createdAt: Date; + }; + + expectTypeOf().toEqualTypeOf(); + }); + + it("should infer the optional properties", () => { + type actualPrimitives = Primitives