Refine VPN client instructions and subscription refresh flow
This commit is contained in:
@@ -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/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user