54 lines
1.2 KiB
Markdown
54 lines
1.2 KiB
Markdown
# 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:**
|
|
```bash
|
|
node tests/test-create-payment-link.cjs
|
|
```
|
|
|
|
**Requirement:**
|
|
- Server harus running di `http://localhost:8000`
|
|
- File `temp/tmp-createtransaksi.json` harus ada dengan payload yang valid
|
|
|
|
### 2. test-frontend-payload.cjs
|
|
Test untuk mensimulasikan payload dari frontend (CheckoutPage.tsx AutoSnapPayment).
|
|
|
|
**Cara menjalankan:**
|
|
```bash
|
|
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:**
|
|
```bash
|
|
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:**
|
|
```bash
|
|
node tests/coreApiSimpleExample.js
|
|
```
|
|
|
|
## Catatan
|
|
|
|
- Semua test file menggunakan `axios` untuk HTTP requests
|
|
- Pastikan server backend sudah running sebelum menjalankan test
|
|
- File temporary/payload test ada di folder `temp/`
|