From c2da004358ce9118c352b5e6233c2716924d5bba Mon Sep 17 00:00:00 2001 From: ChristianSama Date: Thu, 20 Jun 2024 11:37:37 -0500 Subject: [PATCH] Add generic to ElementAssertion --- packages/dom/src/lib/ElementAssertion.ts | 4 ++-- packages/dom/test/unit/lib/ElementAssertion.test.tsx | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/dom/src/lib/ElementAssertion.ts b/packages/dom/src/lib/ElementAssertion.ts index 3c5fc69..1d9ff3c 100644 --- a/packages/dom/src/lib/ElementAssertion.ts +++ b/packages/dom/src/lib/ElementAssertion.ts @@ -1,8 +1,8 @@ import { Assertion, AssertionError } from "@assertive-ts/core"; -export class ElementAssertion extends Assertion { +export class ElementAssertion extends Assertion { - public constructor(actual: Element) { + public constructor(actual: T) { super(actual); } diff --git a/packages/dom/test/unit/lib/ElementAssertion.test.tsx b/packages/dom/test/unit/lib/ElementAssertion.test.tsx index 6cf0418..e2f23c3 100644 --- a/packages/dom/test/unit/lib/ElementAssertion.test.tsx +++ b/packages/dom/test/unit/lib/ElementAssertion.test.tsx @@ -30,14 +30,11 @@ describe("[Unit] ElementAssertion.test.ts", () => { }); }); context("when the element is not in the document", () => { - it("returns the assertion instance", () => { + it("Throws an assertion error", () => { const detachedElement = document.createElement("div"); const test = new ElementAssertion(detachedElement); - expect(test.not.toBeInTheDocument()) - .toBeEqual(test); - expect(() => test.toBeInTheDocument()) .toThrowError(AssertionError) .toHaveMessage("Expected the element to be in the document");