mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-29 01:08:51 +00:00
refactor(web-panel): update architecture + cheat i18n
Reorganize the panel around product capabilities and integrate the remote i18n feature from origin/master into the new structure. - Restructure src into capability features (app, trainer, library, remote-session, appearance, shared); move the bridge to bridge/src. - Add lingui-based UI localization and wrap remaining user-facing strings (Trans / msg macros); fix the 'END В·' mojibake. - Port WeMod cheat-metadata i18n: capture the access token from the snapshot's renderer in the bridge and fetch localized trainer_meta in remote-session.i18n; guarantee snapshot sync on token failure. - Wire vitest to the app's lingui/preact pipeline (mergeConfig).
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { PROTOCOL_VERSION } from './contract';
|
||||
import { isIncomingMessage, isOutgoingMessage } from './validation';
|
||||
|
||||
describe('web protocol validation', () => {
|
||||
it('rejects messages with another envelope version', () => {
|
||||
expect(isIncomingMessage({
|
||||
type: 'error',
|
||||
version: PROTOCOL_VERSION + 1,
|
||||
requestId: null,
|
||||
payload: { code: 'bad', message: 'bad' },
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects incomplete required payloads', () => {
|
||||
expect(isIncomingMessage({
|
||||
type: 'hello_ack',
|
||||
version: PROTOCOL_VERSION,
|
||||
requestId: null,
|
||||
payload: { accepted: true },
|
||||
})).toBe(false);
|
||||
expect(isOutgoingMessage({
|
||||
type: 'set_value',
|
||||
version: PROTOCOL_VERSION,
|
||||
requestId: 'set',
|
||||
payload: { target: 'speed', value: 1 },
|
||||
})).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user