mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-03-10 15:48:10 +00:00
attempt to resolve test errors on Github, object of type unknown error
This commit is contained in:
@@ -190,7 +190,7 @@ describe("Checkout", (): void => {
|
||||
|
||||
const paymentsRequest: PaymentRequest = createPaymentsCheckoutRequest();
|
||||
await checkout.payments(paymentsRequest);
|
||||
} catch (e: any) {
|
||||
} catch (e) {
|
||||
expect(e instanceof HttpClientException).toBeTruthy();
|
||||
}
|
||||
});
|
||||
@@ -285,7 +285,9 @@ describe("Checkout", (): void => {
|
||||
new Checkout(client);
|
||||
fail();
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual("Please provide your unique live url prefix on the setEnvironment() call on the Client or provide checkoutEndpoint in your config object.");
|
||||
if (e instanceof Error) {
|
||||
expect(e.message).toEqual("Please provide your unique live url prefix on the setEnvironment() call on the Client or provide checkoutEndpoint in your config object.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ const getResponse = async ({apiKey , environment }: { apiKey: string; environmen
|
||||
fail("request should fail");
|
||||
} catch (e) {
|
||||
expect(e instanceof ErrorException).toBeTruthy();
|
||||
if (errorMessageEquals) expect(e.message).toEqual(errorMessageEquals);
|
||||
if (errorMessageContains) expect(e.message.toLowerCase()).toContain(errorMessageContains);
|
||||
if (errorMessageEquals && e.message) expect(e.message).toEqual(errorMessageEquals);
|
||||
if (errorMessageContains && e.message) expect(e.message.toLowerCase()).toContain(errorMessageContains);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ describe("Modification", (): void => {
|
||||
const result = await modification.amountUpdates(paymentPspReference, request);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -211,8 +211,8 @@ describe("Modification", (): void => {
|
||||
try {
|
||||
await modification.amountUpdates(invalidPaymentPspReference, request);
|
||||
} catch (e) {
|
||||
expect(e.statusCode).toBe(422);
|
||||
expect(e.message).toContain("Original pspReference required for this operation");
|
||||
if(e.statusCode) expect(e.statusCode).toBe(422);
|
||||
if(e.message) expect(e.message).toContain("Original pspReference required for this operation");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -225,7 +225,7 @@ describe("Modification", (): void => {
|
||||
const result = await modification.cancels(paymentPspReference, request);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -238,8 +238,8 @@ describe("Modification", (): void => {
|
||||
try {
|
||||
await modification.cancels(invalidPaymentPspReference, request);
|
||||
} catch (e) {
|
||||
expect(e.statusCode).toBe(422);
|
||||
expect(e.message).toContain("Original pspReference required for this operation");
|
||||
if(e.statusCode) expect(e.statusCode).toBe(422);
|
||||
if(e.message) expect(e.message).toContain("Original pspReference required for this operation");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -252,7 +252,7 @@ describe("Modification", (): void => {
|
||||
const result = await modification.cancelsStandalone(request);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -265,7 +265,7 @@ describe("Modification", (): void => {
|
||||
const result = await modification.captures(paymentPspReference, request);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -278,8 +278,8 @@ describe("Modification", (): void => {
|
||||
try {
|
||||
await modification.captures(invalidPaymentPspReference, request);
|
||||
} catch (e) {
|
||||
expect(e.statusCode).toBe(422);
|
||||
expect(e.message).toContain("Original pspReference required for this operation");
|
||||
if(e.statusCode) expect(e.statusCode).toBe(422);
|
||||
if(e.message) expect(e.message).toContain("Original pspReference required for this operation");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -292,7 +292,7 @@ describe("Modification", (): void => {
|
||||
const result = await modification.refunds(paymentPspReference, request);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -305,8 +305,8 @@ describe("Modification", (): void => {
|
||||
try {
|
||||
await modification.refunds(invalidPaymentPspReference, request);
|
||||
} catch (e) {
|
||||
expect(e.statusCode).toBe(422);
|
||||
expect(e.message).toContain("Original pspReference required for this operation");
|
||||
if(e.statusCode) expect(e.statusCode).toBe(422);
|
||||
if(e.message) expect(e.message).toContain("Original pspReference required for this operation");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -319,7 +319,7 @@ describe("Modification", (): void => {
|
||||
const result = await modification.reversals(paymentPspReference, request);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -332,8 +332,8 @@ describe("Modification", (): void => {
|
||||
try {
|
||||
await modification.reversals(invalidPaymentPspReference, request);
|
||||
} catch (e) {
|
||||
expect(e.statusCode).toBe(422);
|
||||
expect(e.message).toContain("Original pspReference required for this operation");
|
||||
if(e.statusCode) expect(e.statusCode).toBe(422);
|
||||
if(e.message) expect(e.message).toContain("Original pspReference required for this operation");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -98,7 +98,7 @@ describe("Recurring", (): void => {
|
||||
const result = await recurring.disable(request);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -124,7 +124,7 @@ describe("Recurring", (): void => {
|
||||
const result = await recurring.notifyShopper(notifyShopperRequest);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -155,7 +155,7 @@ describe("Recurring", (): void => {
|
||||
const result = await recurring.scheduleAccountUpdater(request);
|
||||
expect(result).toBeTruthy();
|
||||
} catch (e) {
|
||||
fail(e.message);
|
||||
if(e.message) fail(e.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ describe("Terminal Local API", (): void => {
|
||||
await terminalLocalAPI.request(terminalAPIPaymentRequest, securityKey);
|
||||
} catch (e) {
|
||||
expect(e instanceof NexoCryptoException);
|
||||
expect(e.message).toEqual("Hmac validation failed");
|
||||
if(e.message) expect(e.message).toEqual("Hmac validation failed");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user