Fortune_Tester/README.md
2026-04-06 14:01:26 +03:00

157 lines
2.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Fortune Tester
<video src="https://gitea.yaltopia.com/FortuneSystem/Fortune_Tester/raw/branch/master/demo.mp4" controls></video>
This is a tiny powershell script that i use to test the backend quickly.
It probably would be better have unit and integration tests on the backend directly
but alas, there is never any time to do something like this.
You will need for fzf (use scoop / choco) and PSFzf
## ⚙️ Requirements
Youll need:
* **PowerShell** (obviously)
* **fzf** (for interactive selection)
* Install via `scoop install fzf` or `choco install fzf`
* **PSFzf** (PowerShell integration for fzf)
---
## 🚀 Getting Started
Load the CLI helpers:
```powershell
. ./fortune.ps1
```
Then launch the interactive test menu:
```powershell
. ./fortune_tests.ps1
```
This will open an `fzf` selector listing all available test functions.
---
## 🧠 How It Works
* Every function inside `fortune_tests.ps1` is automatically registered
* The `Main` function scans and feeds them into `fzf`
* You select a function → provide params → it runs
---
## 🔐 Authentication Helpers
These functions log you in and store tokens globally for reuse:
* `LoginClient`
* `LoginAdmin`
* `LoginSuper`
They automatically populate:
* `$Global:FortuneBetToken`
* `$Global:FortuneBetRefreshToken`
So you dont have to manually copy tokens
---
## 📡 Core Command
Everything ultimately goes through:
```powershell
fortune call <METHOD> <PATH> [-Tenant] [-Body @{...}]
```
### Example
```powershell
fortune call GET "leagues" -Tenant
```
---
## 🧪 Adding New Tests
Add a new function inside `fortune_tests.ps1`:
```powershell
function MyNewTest {
fortune call GET "some-endpoint" -Tenant
}
```
Thats it. It will automatically appear in the selector.
---
## 🧩 Available Test Categories
### Payments
* CryptoPay (deposit, withdrawal)
* Chapa (deposit, banks, withdrawal)
* ArifPay (checkout)
### Direct Deposits
* Create / Approve / Reject
* Bank cycling
* Account management
### Betting
* Event → Odds → Selection pipeline (`EventOddPipe`)
* Bet placement (`CreateBet`)
### Virtual Games
* Providers
* Game listing
* Demo launch
### Admin / Super Admin
* Bank management
* Direct deposit bank setup
---
## 🔄 Token Refresh
```powershell
fortune refresh
```
Uses the stored refresh token to get a new access token.
---
## 🧱 Environment Variables
Defined in `fortune.ps1`:
```powershell
$Global:ApiBase = "http://127.0.0.1:8080/api/v1"
$Global:TenantSlug = "fortunebets"
```
Change these if youre pointing to a different environment.
---
## 💡 Why This Exists
Because postman takes alot of RAM
---