From 121524d8b135ac0fe10b9eaee4e6c92ed1e4a8cc Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Tue, 28 Dec 2021 01:07:02 +0100 Subject: [PATCH] Improved some other tests --- spec/PKPass.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/spec/PKPass.ts b/spec/PKPass.ts index ec35a18..e5c9979 100644 --- a/spec/PKPass.ts +++ b/spec/PKPass.ts @@ -25,12 +25,7 @@ describe("PKPass", () => { }; beforeEach(() => { - pass = new PKPass( - {}, - /** @ts-ignore - We don't need certificates here*/ - baseCerts, - {}, - ); + pass = new PKPass({}); }); describe("constructor", () => { @@ -456,8 +451,13 @@ describe("PKPass", () => { wwdr: "", }; }).toThrow(); + }); - /** Expecting previous result */ + it("should accept complete object", () => { + pass.certificates = baseCerts; + expect(pass[certificatesSymbol]).toEqual(baseCerts); + + pass = new PKPass({}, baseCerts); expect(pass[certificatesSymbol]).toEqual(baseCerts); }); }); @@ -1134,12 +1134,11 @@ describe("PKPass", () => { PKPass.from({}), ).toBeRejected(), expectAsync( - /** Missing certificates error */ - // @ts-expect-error + /** Empty model validation error */ PKPass.from({ model: "" }), ).toBeRejected(), expectAsync( - /** Missing model error */ + /** Missing model error and no certificates */ // @ts-expect-error PKPass.from({ certificates: {} }), ).toBeRejected(),