Refactor VPN proxy client implementation
Build and Deploy Gateway / build-and-push (push) Failing after 2s
Build and Deploy Gateway / deploy (push) Has been skipped

This commit is contained in:
2026-08-09 00:41:52 +03:00
parent 32be4380a3
commit 34d8b681ad
190 changed files with 20064 additions and 9761 deletions
+11 -1
View File
@@ -4,7 +4,7 @@ import test from 'node:test';
import {
parseSubscriptionBody,
selectRefreshedServer,
} from '../../src/server/subscription.js';
} from '../../dist/server/subscription.js';
const parse = (outbounds) => parseSubscriptionBody(JSON.stringify({ outbounds }));
const outbound = (tag, server, server_port = 443) => ({
@@ -76,3 +76,13 @@ test('provider placeholders never become selectable servers', () => {
assert.deepEqual(parsed.servers.map((server) => server.label), ['Amsterdam']);
assert.equal(parsed.config.outbounds.length, 1);
});
test('subscription parser rejects JSON primitives and arrays', () => {
for (const value of [null, [], 42, true, 'provider rejected']) {
assert.throws(
() => parseSubscriptionBody(JSON.stringify(value)),
(error) => error.code === 'SUBSCRIPTION_INVALID',
`expected ${JSON.stringify(value)} to be rejected`,
);
}
});