added tests for modification service

This commit is contained in:
wouterboe
2021-05-06 11:27:31 +02:00
parent 9db8ea9399
commit 4c6978cf94

View File

@@ -30,7 +30,7 @@ const modificationResult: IPayouts.ModifyResponse = {
const createModificationRequest = (): IPayments.ModificationRequest => {
return {
merchantAccount: process.env.ADYEN_MERCHANT!,
originalReference: "862615382016087C",
originalReference: "863620292981235A",
modificationAmount: {
value: 500 ,
currency: "EUR"
@@ -44,7 +44,6 @@ const createCancelRequest = (): IPayments.ModificationRequest => {
originalReference: "862615382016087C"
};
};
const isCI = process.env.CI === "true" || (typeof process.env.CI === "boolean" && process.env.CI);
let client: Client;
let modification: Modification;
@@ -64,7 +63,7 @@ afterEach(() => {
});
describe("Modification", (): void => {
test.each([isCI, true])("should perform a refund, isMock: %p", async (isMock): Promise<void> => {
test.each([false, true])("should perform a refund, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
scope.post("/refund")
.reply(200, modificationResult);
@@ -78,7 +77,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a capture, isMock: %p", async (isMock): Promise<void> => {
test.each([false, true])("should perform a capture, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
scope.post("/capture")
.reply(200, modificationResult);
@@ -92,7 +91,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a cancelOrRefund, isMock: %p", async (isMock): Promise<void> => {
test.each([false, true])("should perform a cancelOrRefund, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
scope.post("/cancelOrRefund")
.reply(200, modificationResult);
@@ -106,7 +105,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a cancel, isMock: %p", async (isMock): Promise<void> => {
test.each([false, true])("should perform a cancel, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
scope.post("/cancel")
.reply(200, modificationResult);
@@ -120,7 +119,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a technicalCancel, isMock: %p", async (isMock): Promise<void> => {
test.each([false, true])("should perform a technicalCancel, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
scope.post("/technicalCancel")
.reply(200, modificationResult);
@@ -134,7 +133,7 @@ describe("Modification", (): void => {
}
});
test.each([isCI, true])("should perform a adjustAuthorisation, isMock: %p", async (isMock): Promise<void> => {
test.each([false, true])("should perform a adjustAuthorisation, isMock: %p", async (isMock): Promise<void> => {
!isMock && nock.restore();
scope.post("/adjustAuthorisation")
.reply(200, modificationResult);