1.2 KiB
1.2 KiB
Tests
Folder ini berisi file-file testing untuk Simaya Midtrans Payment Integration.
File Testing
1. test-create-payment-link.cjs
Test untuk membuat payment link menggunakan endpoint /createtransaksi.
Cara menjalankan:
node tests/test-create-payment-link.cjs
Requirement:
- Server harus running di
http://localhost:8000 - File
temp/tmp-createtransaksi.jsonharus ada dengan payload yang valid
2. test-frontend-payload.cjs
Test untuk mensimulasikan payload dari frontend (CheckoutPage.tsx AutoSnapPayment).
Cara menjalankan:
node tests/test-frontend-payload.cjs
Requirement:
- Server harus running di
http://localhost:8000
3. test-snap-token.cjs
Test untuk mendapatkan Snap token dari Midtrans.
Cara menjalankan:
node tests/test-snap-token.cjs
Requirement:
- Server harus running di
http://localhost:8000
4. coreApiSimpleExample.js
Contoh sederhana penggunaan Midtrans Core API.
Cara menjalankan:
node tests/coreApiSimpleExample.js
Catatan
- Semua test file menggunakan
axiosuntuk HTTP requests - Pastikan server backend sudah running sebelum menjalankan test
- File temporary/payload test ada di folder
temp/