feat(payments): add bulk class payments creation and duplicate check
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
const { describe, it } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const paymentService = require('./paymentService');
|
||||
|
||||
describe('Bulk Payment and Duplicate Check Service', () => {
|
||||
it('exports createBulkClassPayments and checkDuplicatePayment', () => {
|
||||
assert.equal(typeof paymentService.createBulkClassPayments, 'function');
|
||||
assert.equal(typeof paymentService.checkDuplicatePayment, 'function');
|
||||
});
|
||||
|
||||
it('checkDuplicatePayment returns false when userId is not provided', async () => {
|
||||
const result = await paymentService.checkDuplicatePayment({});
|
||||
assert.deepEqual(result, {
|
||||
hasDuplicate: false,
|
||||
count: 0,
|
||||
payments: []
|
||||
});
|
||||
});
|
||||
|
||||
it('createBulkClassPayments throws error when classId is missing', async () => {
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await paymentService.createBulkClassPayments({});
|
||||
},
|
||||
(err) => {
|
||||
assert.equal(err.errorCode, 'VALIDATION_FAILED');
|
||||
return true;
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user