【发布时间】:2020-12-02 15:07:30
【问题描述】:
您将如何编写集成测试来测试我的节点应用程序中的 Stripe 集成?
现在我有一个非常简单的节点应用程序,它使用 Stripe 接受信用卡/借记卡付款。
我正在使用以下 Stripe 库 https://github.com/stripe/stripe-node
例如
const charge = await stripe.charges.create({
amount: 2000,
currency: GBP,
source: id,
});
if (!charge) throw new Error("charge unsuccessful");
res.status(200).json({
message: "charge posted successfully",
charge,
});
我可以手动测试功能。
如何使用集成和单元测试来测试此功能?
【问题讨论】:
标签: javascript node.js unit-testing stripe-payments integration-testing