feat(payments): add bulk class payments creation and duplicate check

This commit is contained in:
2026-08-23 13:28:06 +03:30
parent 4c07ca2ae1
commit 28d401fd0e
5 changed files with 177 additions and 1 deletions
+33
View File
@@ -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;
}
);
});
});