Skip to content

Commit

Permalink
Create payments.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 3, 2024
1 parent f97c26f commit 0f1b05d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/payments.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// tests/payments.test.js
const Payments = require('../payments'); // Assuming you have a payments module

describe('Payments Module', () => {
let payments;

beforeEach(() => {
payments = new Payments();
});

test('should process payment correctly', () => {
const result = payments.processPayment(100, 'credit_card');
expect(result).toBe('Payment processed');
});

test('should not allow payment with insufficient funds', () => {
expect(() => payments .processPayment(1000, 'credit_card')).toThrow('Insufficient funds');
});
});

0 comments on commit 0f1b05d

Please sign in to comment.