add(feat): verification
This commit is contained in:
@@ -16,13 +16,18 @@ const snapService = require('../../app/modules/snap/services/snap.service');
|
||||
describe('SnapService', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
process.env.PROJECT_ID = 'CBT';
|
||||
});
|
||||
|
||||
it('should create a snap transaction successfully', async () => {
|
||||
const payload = { order_id: 'u-snap', external_id: 'INV-S-001', amount: 100000 };
|
||||
mockCreateTransaction.mockResolvedValue({ token: 't-123', redirect_url: 'http://m.com' });
|
||||
const result = await snapService.createTransaction(payload);
|
||||
expect(mockCreateTransaction).toHaveBeenCalled();
|
||||
expect(mockCreateTransaction).toHaveBeenCalledWith(expect.objectContaining({
|
||||
transaction_details: expect.objectContaining({
|
||||
order_id: 'INV-S-001-CBT'
|
||||
})
|
||||
}));
|
||||
expect(result.token).toBe('t-123');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user