Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ jobs:
env:
NODE_ENV: test
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
TEST_PROFILE_ID: '38803b9a-e46a-11e9-8963-cf859c103d6e'
TEST_DESTINATION_PHONE_NUMBER: '+16463893770'
TEST_PROFILE_ID: '350155e2-5f67-11f1-a3a8-eb2d5913f5de'
TEST_DESTINATION_PHONE_NUMBER: '+121273631000'
2 changes: 1 addition & 1 deletion src/lib/NumbersClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SMSClient } from './sms/SMSClient';
import { RoutingClient } from './routing/RoutingClient';
import { raiseGqlErrors } from './util';

export const DEFAULT_BASE_URL = 'https://numbers.assemble.live';
export const DEFAULT_BASE_URL = 'https://switchboard.spokewtr.com';

export type RequestFactory = () => request.SuperAgentRequest;
export type RequestFactoryWrapper = (path?: string) => RequestFactory;
Expand Down
11 changes: 8 additions & 3 deletions src/lib/routing/RoutingClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,26 @@ const { TEST_API_KEY, TEST_PROFILE_ID, TEST_DESTINATION_PHONE_NUMBER } =
const REQUEST: RequestFactoryWrapper = (path) => () =>
request.get(`${DEFAULT_BASE_URL}${path}`).set('token', TEST_API_KEY);

const TEST_ZIP = '11050';
const TEST_NUMBER_CA = '+12137363100';

test('can get number for contact', async (t) => {
const client = new RoutingClient({ requestWrapper: REQUEST });
const response = await client.getNumberForContact({
toNumber: TEST_DESTINATION_PHONE_NUMBER,
profileId: TEST_PROFILE_ID,
contactZipCode: '10001',
contactZipCode: TEST_ZIP,
});
t.is(typeof response.fromNumber, 'string');
t.true(response.fromNumber.startsWith('+1516'));
});

test('can get number for contact without zip code', async (t) => {
const client = new RoutingClient({ requestWrapper: REQUEST });
const response = await client.getNumberForContact({
toNumber: TEST_DESTINATION_PHONE_NUMBER,
toNumber: TEST_NUMBER_CA,
profileId: TEST_PROFILE_ID,
});

t.is(typeof response.fromNumber, 'string');
t.true(response.fromNumber.startsWith('+1202'));
});
Loading