REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 3.29 KB
Close
/home/byroehnu/.trash/node_modules11/flutterwave-node-v3/test/rave.ebills.test.js
Text
Base64
var ebills = require('../lib/rave.ebills'); var base = require('../lib/rave.base'); 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 Ebills', function () { const public_key = process.env.PUBLIC_KEY; const secret_key = process.env.SECRET_KEY; const ravebase = new base(public_key, secret_key); let ebillsInstance; beforeEach(() => { ebillsInstance = new ebills(ravebase); }); afterEach(() => { sinon.restore(); }); it('should create a new Ebills order', async function () { this.timeout(10000); // STUB: request to ensure services/ebills logic is hit const requestStub = sinon.stub(ravebase, 'request').resolves({ body: { status: 'success', message: 'Ebills ordered', data: { flw_ref: 'RVEBLS-F35542EA3BFE-73362', tx_ref: 'akhlm-pstmn-109470393', response_message: 'Pending funds transfer', }, }, }); var payload = { number_of_units: 2, currency: 'NGN', amount: 100, phone_number: '09384747474', email: 'jake@rad.com', tx_ref: 'akhlm-pstmn-109470393', ip: '127.9.0.7', custom_business_name: 'John Madakin', country: 'NG', }; const resp = await ebillsInstance.order(payload); expect(requestStub).to.have.been.calledOnce; expect(resp, "Service returned undefined").to.not.be.undefined; expect(resp).to.have.property('status', 'success'); }); it('testing the phone number validation required to create a new Ebills order', async function () { this.timeout(10000); const requestStub = sinon.stub(ravebase, 'request').resolves({ body: { status: 'success' } }); var payload = { number_of_units: 2, currency: 'NGN', amount: 100, phone_number: 'ffrrrtrrtr', email: 'jake@rad.com', tx_ref: 'akhlm-pstmn-109470393', ip: '127.9.0.7', custom_business_name: 'John Madakin', country: 'NG', }; await expect(ebillsInstance.order(payload)) .to.be.rejectedWith('phone number should be digits'); expect(requestStub).to.not.have.been.called; }); it('should update an Ebills order', async function () { this.timeout(10000); const requestStub = sinon.stub(ravebase, 'request').resolves({ body: { status: 'success', message: 'Ebills order updated', data: { updated: true }, }, }); var payload = { currency: 'NGN', amount: 4000, reference: 'RVEBLS-F81CEEEE8218-73362', }; const resp = await ebillsInstance.update(payload); expect(requestStub).to.have.been.calledOnce; expect(resp).to.have.property('status', 'success'); }); it('should fail if email is missing', async function () { const requestStub = sinon.stub(ravebase, 'request').resolves({ body: { status: 'success' } }); var invalidPayload = { amount: 100 }; // Missing email and other fields await expect(ebillsInstance.order(invalidPayload)).to.be.rejectedWith(/"email" is required/); expect(requestStub).to.not.have.been.called; }); });
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).