Skip to content

Commit

Permalink
chore: use a new util for garl destination
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai Sankeerth committed Jul 1, 2024
1 parent 641095e commit 5d84b28
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
generateMetadata,
generateGoogleOAuthMetadata,
generateProxyV0Payload,
generateProxyV1Payload,
} from '../../../testUtils';
Expand Down Expand Up @@ -90,7 +90,7 @@ const invalidArgumentRequestPayload = {
],
};

const metadataArray = [generateMetadata(1)];
const metadataArray = [generateGoogleOAuthMetadata(1)];

const expectedStatTags = {
destType: 'GOOGLE_ADWORDS_REMARKETING_LISTS',
Expand Down Expand Up @@ -272,7 +272,7 @@ export const testScenariosForV1API = [
response: [
{
error: '""',
metadata: generateMetadata(1),
metadata: generateGoogleOAuthMetadata(1),
statusCode: 200,
},
],
Expand Down Expand Up @@ -318,7 +318,7 @@ export const testScenariosForV1API = [
{
error:
'Request contains an invalid argument. during ga_audience response transformation',
metadata: generateMetadata(1),
metadata: generateGoogleOAuthMetadata(1),
statusCode: 400,
},
],
Expand Down Expand Up @@ -363,7 +363,7 @@ export const testScenariosForV1API = [
response: [
{
error: '""',
metadata: generateMetadata(1),
metadata: generateGoogleOAuthMetadata(1),
statusCode: 200,
},
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Destination, RouterTransformationRequest } from '../../../../../src/types';
import { generateMetadata } from '../../../testUtils';
import { generateGoogleOAuthMetadata } from '../../../testUtils';

const destination: Destination = {
Config: {
Expand Down Expand Up @@ -30,7 +30,7 @@ const destination: Destination = {
export const rETLAudienceRouterRequest: RouterTransformationRequest = {
input: [
{
metadata: generateMetadata(1),
metadata: generateGoogleOAuthMetadata(1),
destination: destination,
message: {
userId: 'user 1',
Expand All @@ -57,7 +57,7 @@ export const rETLAudienceRouterRequest: RouterTransformationRequest = {
},
},
{
metadata: generateMetadata(3),
metadata: generateGoogleOAuthMetadata(3),
destination: destination,
message: {
userId: 'user 1',
Expand All @@ -84,7 +84,7 @@ export const rETLAudienceRouterRequest: RouterTransformationRequest = {
},
},
{
metadata: generateMetadata(4),
metadata: generateGoogleOAuthMetadata(4),
destination: destination,
message: {
userId: 'user 1',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Destination, RouterTransformationRequest } from '../../../../../src/types';
import { generateMetadata } from '../../../testUtils';
import { generateGoogleOAuthMetadata } from '../../../testUtils';

const destination: Destination = {
Config: {
Expand Down Expand Up @@ -51,7 +51,7 @@ export const rETLRecordRouterRequest: RouterTransformationRequest = {
},
type: 'record',
},
metadata: generateMetadata(2),
metadata: generateGoogleOAuthMetadata(2),
},
{
destination: destination,
Expand All @@ -75,7 +75,7 @@ export const rETLRecordRouterRequest: RouterTransformationRequest = {
},
type: 'record',
},
metadata: generateMetadata(4),
metadata: generateGoogleOAuthMetadata(4),
},
{
destination: destination,
Expand All @@ -99,7 +99,7 @@ export const rETLRecordRouterRequest: RouterTransformationRequest = {
},
type: 'record',
},
metadata: generateMetadata(1),
metadata: generateGoogleOAuthMetadata(1),
},
{
destination: destination,
Expand All @@ -123,7 +123,7 @@ export const rETLRecordRouterRequest: RouterTransformationRequest = {
},
type: 'record',
},
metadata: generateMetadata(5),
metadata: generateGoogleOAuthMetadata(5),
},
{
destination: destination,
Expand All @@ -147,7 +147,7 @@ export const rETLRecordRouterRequest: RouterTransformationRequest = {
},
type: 'record',
},
metadata: generateMetadata(3),
metadata: generateGoogleOAuthMetadata(3),
},
],
destType: 'google_adwords_remarketing_lists',
Expand Down
13 changes: 13 additions & 0 deletions test/integrations/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,19 @@ export const generateMetadata = (jobId: number): any => {
workspaceId: 'default-workspaceId',
secret: {
accessToken: 'default-accessToken',
},
dontBatch: false,
};
};
export const generateGoogleOAuthMetadata = (jobId: number): any => {
return {
jobId,
attemptNum: 1,
userId: 'default-userId',
sourceId: 'default-sourceId',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
secret: {
access_token: 'default-accessToken', // applicable for google destinations
},
dontBatch: false,
Expand Down

0 comments on commit 5d84b28

Please sign in to comment.