fix: default SMS Bower country to Indonesia
This commit is contained in:
@@ -6,8 +6,8 @@
|
|||||||
const DEFAULT_BASE_URL = 'https://smsbower.page/stubs/handler_api.php';
|
const DEFAULT_BASE_URL = 'https://smsbower.page/stubs/handler_api.php';
|
||||||
const DEFAULT_SERVICE_CODE = 'ot';
|
const DEFAULT_SERVICE_CODE = 'ot';
|
||||||
const DEFAULT_SERVICE_LABEL = 'OpenAI';
|
const DEFAULT_SERVICE_LABEL = 'OpenAI';
|
||||||
const DEFAULT_COUNTRY_ID = 52;
|
const DEFAULT_COUNTRY_ID = 6;
|
||||||
const DEFAULT_COUNTRY_LABEL = 'Thailand';
|
const DEFAULT_COUNTRY_LABEL = 'Indonesia';
|
||||||
const DEFAULT_REQUEST_TIMEOUT_MS = 20000;
|
const DEFAULT_REQUEST_TIMEOUT_MS = 20000;
|
||||||
const DEFAULT_POLL_TIMEOUT_MS = 180000;
|
const DEFAULT_POLL_TIMEOUT_MS = 180000;
|
||||||
const DEFAULT_POLL_INTERVAL_MS = 5000;
|
const DEFAULT_POLL_INTERVAL_MS = 5000;
|
||||||
|
|||||||
@@ -14,6 +14,26 @@ function createTextResponse(payload, ok = true, status = ok ? 200 : 400, statusT
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test('SMS Bower provider defaults to Indonesia when no country is configured', async () => {
|
||||||
|
const requests = [];
|
||||||
|
const provider = api.createProvider({
|
||||||
|
fetchImpl: async (url, options = {}) => {
|
||||||
|
const parsed = new URL(url);
|
||||||
|
requests.push({ url: parsed, options });
|
||||||
|
if (parsed.searchParams.get('action') === 'getNumber') {
|
||||||
|
return createTextResponse('ACCESS_NUMBER:67890:6281234567890');
|
||||||
|
}
|
||||||
|
throw new Error(`unexpected ${parsed.toString()}`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const activation = await provider.requestActivation({ smsBowerApiKey: 'demo-key' });
|
||||||
|
|
||||||
|
assert.equal(requests[0].url.searchParams.get('country'), '6');
|
||||||
|
assert.equal(activation.countryId, 6);
|
||||||
|
assert.equal(activation.countryLabel, 'Indonesia');
|
||||||
|
});
|
||||||
|
|
||||||
test('SMS Bower provider uses handler API key query for balance and price catalog', async () => {
|
test('SMS Bower provider uses handler API key query for balance and price catalog', async () => {
|
||||||
const requests = [];
|
const requests = [];
|
||||||
const provider = api.createProvider({
|
const provider = api.createProvider({
|
||||||
|
|||||||
Reference in New Issue
Block a user