34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
'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;
|
|
}
|
|
);
|
|
});
|
|
});
|