add(feat): verification
This commit is contained in:
@@ -18,13 +18,18 @@ const creditCardService = require('../../app/modules/credit-card/services/credit
|
||||
describe('CreditCardService', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
process.env.PROJECT_ID = 'CBT';
|
||||
});
|
||||
|
||||
it('should create a credit card transaction successfully', async () => {
|
||||
const payload = { order_id: 'u-cc', external_id: 'INV-CC-001', amount: 500000, credit_card_token: 't-123' };
|
||||
mockCharge.mockResolvedValue({ status_code: '201', transaction_status: 'capture' });
|
||||
const result = await creditCardService.createTransaction(payload);
|
||||
expect(mockCharge).toHaveBeenCalled();
|
||||
expect(mockCharge).toHaveBeenCalledWith(expect.objectContaining({
|
||||
transaction_details: expect.objectContaining({
|
||||
order_id: 'INV-CC-001-CBT'
|
||||
})
|
||||
}));
|
||||
expect(result.status_code).toBe('201');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user