azon_seeker/scripts/test-remote-endpoint.ts
Ktight 90110a48f0
Feat/advertisement (#26)
* feat: add Amazon collection metadata and reliable sync

* fix: route extension sync through configured server

* chore: release extension v0.7.13

* fix: handle extension ports across BFCache navigation

* fix: classify bottom Sponsored Brands video placements

* fix: exclude hidden Amazon ad cards

* fix: derive Amazon result page from URL

* fix: ignore hidden Amazon sponsored products

* fix: preserve base Amazon product collection

* fix: bind Amazon results to visible page

* fix: classify visible Amazon ad formats

* fix: wait for lazy Amazon ad modules

* perf: reduce Amazon lazy-load scroll stops

* fix: classify Amazon sponsored brand and video search ads

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: collect Shop by type thematic SP ads via redirect chains without data-asin

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: classify sponsored ads across new Amazon templates

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: PetrichorFun <127877748+PetrichorFun@users.noreply.github.com>
2026-09-10 18:03:11 +08:00

35 lines
943 B
TypeScript

import assert from 'node:assert/strict';
import { resolveRemoteEndpoint } from '../src/logic/remote-endpoint';
assert.deepEqual(resolveRemoteEndpoint({ isDev: true }), {
host: '127.0.0.1:18000',
httpBaseUrl: 'http://127.0.0.1:18000',
webSocketBaseUrl: 'ws://127.0.0.1:18000',
});
assert.deepEqual(resolveRemoteEndpoint({ isDev: false }), {
host: 'amzplugin.rekeymed.com',
httpBaseUrl: 'https://amzplugin.rekeymed.com',
webSocketBaseUrl: 'wss://amzplugin.rekeymed.com',
});
assert.deepEqual(
resolveRemoteEndpoint({
isDev: true,
host: 'staging.example.test:8443',
protocol: 'https',
}),
{
host: 'staging.example.test:8443',
httpBaseUrl: 'https://staging.example.test:8443',
webSocketBaseUrl: 'wss://staging.example.test:8443',
},
);
assert.throws(
() => resolveRemoteEndpoint({ isDev: true, protocol: 'ftp' }),
/Unsupported remote protocol/,
);
console.log('Remote endpoint tests passed.');