134 lines
4.0 KiB
Markdown
134 lines
4.0 KiB
Markdown
# Testing
|
|
|
|
This document describes the test setup, the run commands, and the known gaps.
|
|
|
|
## Unit tests
|
|
|
|
The pure daemon logic has unit tests. The tests cover the ring buffers, the mention helpers, the
|
|
command parser, the poll parser, the trust helpers, the context assembly, the redaction, and the
|
|
pacing range. The cache tests cover merge, dedupe, trimming, and eviction.
|
|
|
|
```sh
|
|
cd poc
|
|
pnpm test:comm
|
|
pnpm test:cache
|
|
```
|
|
|
|
The files are `poc/src/test-communication.ts` and `poc/src/test-cache.ts`. The tests do not need
|
|
Discord or Vesktop.
|
|
|
|
## Type checks
|
|
|
|
```sh
|
|
cd poc && pnpm check # daemon and spike code
|
|
cd .. && pnpm testTypes # Vesktop core
|
|
```
|
|
|
|
Both commands must pass before a change is complete.
|
|
|
|
## Build
|
|
|
|
```sh
|
|
pnpm build
|
|
```
|
|
|
|
The build writes the application to `dist/`.
|
|
|
|
## Mock core test
|
|
|
|
The mock core runs the daemon without Electron.
|
|
|
|
```sh
|
|
# Terminal 1: mock core
|
|
VESKSLOP_SOCKET=/tmp/vesktop-puppet-mock.sock pnpm control:mock
|
|
|
|
# Terminal 2: daemon
|
|
VESKSLOP_SOCKET=/tmp/vesktop-puppet-mock.sock pnpm control:bridge
|
|
|
|
# Terminal 3: inject an owner command
|
|
VESKSLOP_SOCKET=/tmp/vesktop-puppet-mock.sock TEST_TRIGGER_CONTENT="whitelist list" pnpm test:trigger
|
|
```
|
|
|
|
Expected result: the daemon log shows one trusted entry with the parsed command. The mock log shows
|
|
the reply (`message.send`). The reply wait is inside the 500 to 2800 ms window.
|
|
|
|
The mock also covers tiers, continuation, polls, reactions, and the action log. Set config values
|
|
with `set_puppet_config` before a test. Inject a reaction with
|
|
`TEST_TRIGGER_REACTION=1 TEST_REACTION_MESSAGE_ID=msg-1 TEST_REACTION_EMOJI="1️⃣" pnpm test:trigger`.
|
|
|
|
## CDP probe
|
|
|
|
The probe checks the CDP fallback transport. Start the client with
|
|
`--remote-debugging-port=9222` first.
|
|
|
|
```sh
|
|
cd poc
|
|
pnpm cdp:probe
|
|
|
|
# Run one expression in the client.
|
|
CDP_EXPRESSION='Vencord.Webpack.Common.FluxDispatcher.dispatch({...})' pnpm cdp:dispatch
|
|
```
|
|
|
|
A good result shows the Vencord global, the Flux dispatcher, the current user, and one binding
|
|
event.
|
|
|
|
## Live test setup
|
|
|
|
The container has no display and no PipeWire. Use a virtual display.
|
|
|
|
```sh
|
|
# 1. Start a virtual display. On Linux, install Xvfb or extract it locally.
|
|
Xvfb :99 -screen 0 1280x720x24 &
|
|
|
|
# 2. Start the stock client with a pinned profile and remote debugging.
|
|
DISPLAY=:99 \
|
|
VENCORD_USER_DATA_DIR=~/.config/veskslop \
|
|
electron . --no-sandbox --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222
|
|
|
|
# 3. Start the daemon.
|
|
cd poc && pnpm control:bridge
|
|
|
|
# 4. Check the health endpoint.
|
|
curl http://127.0.0.1:8788/health
|
|
```
|
|
|
|
Notes:
|
|
|
|
- `VENCORD_USER_DATA_DIR` pins the Electron profile. The profile holds the client session.
|
|
- Write `{"firstLaunch": false}` to `<DATA_DIR>/state.json` before the first start. This step skips
|
|
the first-launch window. The `VESKSLOP_HEADLESS=1` flag does the same job.
|
|
- The container needs `libasound.so.2` for Electron. Extract the library locally when the system
|
|
package is not available.
|
|
|
|
## Sanctioned live target
|
|
|
|
The only permitted live-send target is user **zzib** (`177117296140091393`). Send a test message
|
|
with this command:
|
|
|
|
```sh
|
|
cd poc
|
|
pnpm poc:dm
|
|
```
|
|
|
|
## Live results
|
|
|
|
The core bridge was verified live on 2026-09-11:
|
|
|
|
- `get_state` returned the real account and 7 guilds.
|
|
- `send_dm` delivered a real DM to zzib.
|
|
- A synthetic owner message flowed through the real event path. The daemon log held the entry with
|
|
the parsed command.
|
|
- The client ran headless under Xvfb with the token seeded from the token file.
|
|
|
|
The CDP transport was verified earlier with the same checks.
|
|
|
|
## Known gaps
|
|
|
|
| Gap | Effect |
|
|
| --- | --- |
|
|
| Live trigger tests need an incoming message. | Use the mock core, or send from zzib's account. |
|
|
| `reaction.add` and the message ID return are mock-verified only. | Confirm Discord's internal `addReaction` lookup on the first live run. |
|
|
| Polls and other chat commands are mock-verified only. | Run them on the live client. |
|
|
| `message.read` is cache-only. | A channel that the client never opened returns zero messages. |
|
|
| Voice, audio, and video are not started. | No coverage. |
|