Refine VPN client instructions and subscription refresh flow
All checks were successful
Build and Deploy Gateway / build-and-push (push) Successful in 14s
Build and Deploy Gateway / deploy (push) Successful in 1s

This commit is contained in:
2026-07-11 12:34:14 +03:00
parent 6f565ded2e
commit fa3b455fab
11 changed files with 730 additions and 36 deletions

View File

@@ -10,6 +10,7 @@ import {
subscriptionDaysLeft,
subscriptionUsage,
} from '../../src/web/utils/clientControls.js';
import { instructionBlocks } from '../../src/web/instructions.js';
test('connection button chooses the only valid client action', () => {
assert.deepEqual(connectionAction({ connected: true }), { type: 'stop' });
@@ -92,3 +93,12 @@ test('subscription expiry uses Russian day forms', () => {
assert.equal(subscriptionDaysLeft(new Date('2026-07-13T00:00:00Z'), now), 'осталось 2 дня');
assert.equal(subscriptionDaysLeft(new Date('2026-07-16T00:00:00Z'), now), 'осталось 5 дней');
});
test('gateway receives router instructions while local client does not', () => {
const gateway = instructionBlocks({ isGateway: true, host: '192.168.1.20', port: 8080 });
const client = instructionBlocks({ isGateway: false, host: '127.0.0.1', port: 8082 });
assert.equal(gateway.at(-1).id, 'router');
assert.equal(client.some((block) => block.id === 'router'), false);
assert.match(client.find((block) => block.id === 'vscode').code, /127\.0\.0\.1:8082/);
});