REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 3.58 KB
Close
/home/byroehnu/.trash/node_modules11/flutterwave-node-v3/test/rave.payment-plan.test.js
Text
Base64
const PaymentPlan = require('../lib/rave.payment_plan'); var base = require('../lib/rave.base'); // var Promise = require('bluebird'); var mocha = require('mocha'); var chai = require('chai'); var expect = chai.expect; var chaiAsPromised = require('chai-as-promised'); var dotenv = require('dotenv').config(); const sinon = require('sinon'); const sinonChai = require('sinon-chai'); chai.use(chaiAsPromised); chai.use(sinonChai); describe('#Rave Payment-plan Coverage', function () { const public_key = process.env.PUBLIC_KEY; const secret_key = process.env.SECRET_KEY; let ravebase; let paymentPlanInstance; beforeEach(() => { ravebase = new base(public_key, secret_key); paymentPlanInstance = new PaymentPlan(ravebase); }); afterEach(() => { sinon.restore(); }); it('should create a payment plan (Covers rave.create.js)', async function () { this.timeout(10000); const requestStub = sinon.stub(ravebase, 'request').resolves({ body: { // SDK services destructure { body } status: 'success', message: 'Payment plan created', data: { id: 52045, status: 'active' } } }); const payload = { amount: "100", name: "SDK test Plan", interval: "monthly" }; const resp = await paymentPlanInstance.create(payload); expect(requestStub).to.have.been.calledOnce; expect(resp.status).to.equal('success'); }); it('should update a payment plan (Covers rave.update.js)', async function () { this.timeout(10000); const requestStub = sinon.stub(ravebase, 'request').resolves({ body: { status: 'success', message: 'Payment plan updated', data: { id: 34185, status: 'active' } } }); const payload = { id: "34185", name: "Updated Plan Name", status: "active" }; const resp = await paymentPlanInstance.update(payload); expect(requestStub).to.have.been.calledOnce; expect(resp.data).to.have.property('status', 'active'); }); it('should cancel a payment plan (Covers rave.cancel.js)', async function () { this.timeout(10000); const requestStub = sinon.stub(ravebase, 'request').resolves({ body: { status: 'success', message: 'Payment plan cancelled', data: { id: 34185, status: 'cancelled' } } }); const payload = { id: "34185" }; const resp = await paymentPlanInstance.cancel(payload); expect(requestStub).to.have.been.calledOnce; expect(resp.message).to.equal('Payment plan cancelled'); }); it('should get a single payment plan (Covers rave.retrieve.js)', async function () { this.timeout(10000); const getAPaymentPlanStub = sinon.stub(ravebase, 'request').resolves({ body: { status: 'success', message: 'Payment plan fetched', data: { id: 52045, name: 'SDK test Plan', status: 'active' } } }); const payload = { id: "52045" }; const resp = await paymentPlanInstance.get_plan(payload); expect(getAPaymentPlanStub).to.have.been.calledOnce; expect(resp).to.have.property('status', 'success'); expect(resp.data).to.have.property('id', 52045); }); it('should get all payment plans (Covers rave.retrieve-all.js)', async function () { this.timeout(10000); const requestStub = sinon.stub(ravebase, 'request').resolves({ body: { status: 'success', message: 'Payment plans fetched', data: [{ id: 37829 }] } }); const resp = await paymentPlanInstance.get_all({}); expect(resp.status).to.equal('success'); }); });
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 16
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
rave.bank.test.js
2.46 KB
lrw-r--r--
2026-02-21 00:53:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.beneficiaries.test.js
3.79 KB
lrw-r--r--
2026-02-21 00:53:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.bills.test.js
16.01 KB
lrw-r--r--
2026-02-21 00:53:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.card.charge.test.js
2.68 KB
lrw-r--r--
2026-02-21 00:54:00
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.charge.test.js
45.37 KB
lrw-r--r--
2026-02-21 00:54:00
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.ebills.test.js
3.29 KB
lrw-r--r--
2026-02-21 00:54:04
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.misc.test.js
3.97 KB
lrw-r--r--
2026-02-21 00:54:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.momo.test.js
26.99 KB
lrw-r--r--
2026-02-21 00:54:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.otp.test.js
2.44 KB
lrw-r--r--
2026-02-21 00:54:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.payment-plan.test.js
3.58 KB
lrw-r--r--
2026-02-21 00:54:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.settlements.test.js
1.63 KB
lrw-r--r--
2026-02-21 00:54:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.subscriptions.test.js
2.74 KB
lrw-r--r--
2026-02-21 00:54:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.tokenization.test.js
8.13 KB
lrw-r--r--
2026-02-21 00:54:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.transactions.test.js
4.91 KB
lrw-r--r--
2026-02-21 00:54:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.transfer.test.js
6.44 KB
lrw-r--r--
2026-02-21 00:54:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rave.virtualcards.test.js
2.21 KB
lrw-r--r--
2026-02-21 00:54:22
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).