From f430bf15154e1ec7093fe65666ad41c87e3088a3 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Sun, 14 Nov 2021 00:43:07 +0100 Subject: [PATCH] Fixed tests for fields getters (seems like that native error messages can change) --- spec/PKPass.ts | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/spec/PKPass.ts b/spec/PKPass.ts index d9999e2..7adce68 100644 --- a/spec/PKPass.ts +++ b/spec/PKPass.ts @@ -463,26 +463,11 @@ describe("PKPass", () => { describe("fields getters", () => { it("should throw error if a type has not been defined", () => { - expect(() => pass.primaryFields).toThrowError( - TypeError, - "Cannot read properties of undefined (reading 'primaryFields')", - ); - expect(() => pass.secondaryFields).toThrowError( - TypeError, - "Cannot read properties of undefined (reading 'secondaryFields')", - ); - expect(() => pass.auxiliaryFields).toThrowError( - TypeError, - "Cannot read properties of undefined (reading 'auxiliaryFields')", - ); - expect(() => pass.headerFields).toThrowError( - TypeError, - "Cannot read properties of undefined (reading 'headerFields')", - ); - expect(() => pass.backFields).toThrowError( - TypeError, - "Cannot read properties of undefined (reading 'backFields')", - ); + expect(() => pass.primaryFields).toThrowError(TypeError); + expect(() => pass.secondaryFields).toThrowError(TypeError); + expect(() => pass.auxiliaryFields).toThrowError(TypeError); + expect(() => pass.headerFields).toThrowError(TypeError); + expect(() => pass.backFields).toThrowError(TypeError); }); it("should return an instance of FieldsArray if a type have been set", () => {