Updated tests to have no redirect to homes (#8494)

This commit is contained in:
Keith Holliday
2017-02-16 16:33:49 -07:00
committed by GitHub
parent 2f9ff92cbd
commit e37ad420ce
6 changed files with 30 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ describe('payments : paypal #checkout', () => {
balance: 2,
});
await user.get(endpoint);
await user.get(`${endpoint}?noRedirect=true`);
expect(checkoutStub).to.be.calledOnce;
expect(checkoutStub.args[0][0].gift).to.eql(undefined);

View File

@@ -53,7 +53,7 @@ describe('payments : paypal #checkoutSuccess', () => {
balance: 2,
});
await user.get(`${endpoint}?PayerID=${customerId}&paymentId=${paymentId}`);
await user.get(`${endpoint}?PayerID=${customerId}&paymentId=${paymentId}&noRedirect=true`);
expect(checkoutSuccessStub).to.be.calledOnce;

View File

@@ -44,7 +44,7 @@ describe('payments : paypal #subscribe', () => {
balance: 2,
});
await user.get(`${endpoint}?sub=${subKey}`);
await user.get(`${endpoint}?sub=${subKey}&noRedirect=true`);
expect(subscribeStub).to.be.calledOnce;

View File

@@ -41,7 +41,7 @@ describe('payments : paypal #subscribeCancel', () => {
balance: 2,
});
await user.get(endpoint);
await user.get(`${endpoint}?noRedirect=true`);
expect(subscribeCancelStub).to.be.calledOnce;

View File

@@ -42,7 +42,7 @@ describe('payments : paypal #subscribeSuccess', () => {
balance: 2,
});
await user.get(`${endpoint}?token=${token}`);
await user.get(`${endpoint}?token=${token}&noRedirect=true`);
expect(subscribeSuccessStub).to.be.calledOnce;

View File

@@ -29,7 +29,11 @@ api.checkout = {
let link = await paypalPayments.checkout({gift});
if (req.query.noRedirect) {
res.respond(200);
} else {
res.redirect(link);
}
},
};
@@ -55,7 +59,11 @@ api.checkoutSuccess = {
await paypalPayments.checkoutSuccess({user, gift, paymentId, customerId});
if (req.query.noRedirect) {
res.respond(200);
} else {
res.redirect('/');
}
},
};
@@ -80,7 +88,11 @@ api.subscribe = {
req.session.paypalBlock = req.query.sub;
req.session.groupId = req.query.groupId;
if (req.query.noRedirect) {
res.respond(200);
} else {
res.redirect(link);
}
},
};
@@ -108,7 +120,11 @@ api.subscribeSuccess = {
await paypalPayments.subscribeSuccess({user, block, groupId, token, headers: req.headers});
if (req.query.noRedirect) {
res.respond(200);
} else {
res.redirect('/');
}
},
};
@@ -128,7 +144,11 @@ api.subscribeCancel = {
await paypalPayments.subscribeCancel({user, groupId});
if (req.query.noRedirect) {
res.respond(200);
} else {
res.redirect('/');
}
},
};