Skip to content

Commit

Permalink
Refactor env var for test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPonchia committed Dec 19, 2024
1 parent 8af9e78 commit 2477350
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions packages/active-campaign-client/.env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
AC_BASE_URL=your_account_url
AC_API_KEY=your_api_key
SENDER_URL=localhost:3000
AWS_REGION="region"
AWS_USER_POOL_ID="region_DFWF81fRa"
COGNITO_USER_ID=66ae52a0-f051-7080-04a1-465b3a4f44cc
LIST_NAME=test-webinar-1732097286071
COGNITO_USER_POOL_ID="region_DFWF81fRa"
AC_BASE_URL_PARAM='/ac/base_url'
AC_API_KEY_PARAM='/ac/api_key'

TEST_AC_BASE_URL=your_account_url
TEST_AC_API_KEY=your_api_key
TEST_AC_LIST_ID=28
TEST_COGNITO_USER_ID=66ae52a0-f051-7080-04a1-465b3a4f44cc
TEST_LIST_NAME=test-webinar-1732097286071
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
} from '../../helpers/manageListSubscription';

describe.skip('manage list subscription', () => {
const cognitoUserId = process.env.COGNITO_USER_ID || '';
const listName = process.env.LIST_NAME || '';
const cognitoUserId = process.env.TEST_COGNITO_USER_ID || '';
const listName = process.env.TEST_LIST_NAME || '';

it('should subscribe the contact to the list', async () => {
const result = await addContactToList(cognitoUserId, listName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export class ActiveCampaignClient {
params?: Record<string, string>
): Promise<T> {
const [apiKey, baseUrl] = await Promise.all([
getParameter(this.apiKeyParam, this.ssm, process.env.AC_API_KEY),
getParameter(this.baseUrlParam, this.ssm, process.env.AC_BASE_URL),
getParameter(this.apiKeyParam, this.ssm, process.env.TEST_AC_API_KEY),
getParameter(this.baseUrlParam, this.ssm, process.env.TEST_AC_BASE_URL),
]);
return new Promise((resolve, reject) => {
// Parse the base URL to get hostname and path and remove any trailing slashes from the baseUrl
Expand Down Expand Up @@ -160,9 +160,9 @@ export class ActiveCampaignClient {

async getLists(ids?: readonly string[]) {
const limitParams = { limit: '1000' };
return this.makeRequest<readonly ActiveCampaignList[]>(
return this.makeRequest<{ readonly lists: readonly ActiveCampaignList[] }>(
'GET',
`/api/3/lists`,
'/api/3/lists',
undefined,
ids && ids.length > 0
? { ids: ids.join(','), ...limitParams }
Expand Down

0 comments on commit 2477350

Please sign in to comment.