Skip to content

Commit

Permalink
refactor: migrate google cloud function to component tests (#2588)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSudip authored Sep 12, 2023
1 parent 044aae7 commit e564f80
Showing 1 changed file with 260 additions and 0 deletions.
260 changes: 260 additions & 0 deletions test/integrations/destinations/google_cloud_function/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
export const data = [
{
name: 'google_cloud_function',
description: 'Test 0',
feature: 'router',
module: 'destination',
version: 'v0',
input: {
request: {
body: {
input: [
{
destination: {
Config: {
triggerType: 'Http',
apiKeyId: 'randomAPI',
enableBatchInput: true,
googleCloudFunctionUrl:
'https://us-central1-big-query-integration-poc.cloudfunctions.net/rohitv1',
maxBatchSize: '2',
},
},
metadata: {
jobId: '1',
},
message: {
channel: 'web',
context: {
app: {
build: '1.0.0',
name: 'RudderLabs JavaScript SDK',
namespace: 'com.rudderlabs.javascript',
version: '1.0.0',
},
library: {
name: 'RudderLabs JavaScript SDK',
version: '1.0.0',
},
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
locale: 'en-US',
ip: '0.0.0.0',
os: {
name: '',
version: '',
},
screen: {
density: 2,
},
},
messageId: '84e26acc-56a5-4835-8233-591137fca468',
session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22',
originalTimestamp: '2019-10-14T09:03:17.562Z',
anonymousId: 'anon_id',
type: 'identify',
traits: {
email: '[email protected]',
name: 'Cosmo Krammer',
linkedinUrl: 'https://linkedin.com/cosmo-krammer',
location: 'New York',
emailOptOut: true,
masterAvatarTypeCode: 10,
},
integrations: {
All: true,
},
sentAt: '2019-10-14T09:03:22.563Z',
},
},
{
destination: {
Config: {
triggerType: 'Http',
apiKeyId: 'randomAPI',
enableBatchInput: true,
googleCloudFunctionUrl: '',
maxBatchSize: '2',
},
},
metadata: {
jobId: '2',
},
message: {
channel: 'web',
context: {
app: {
build: '1.0.0',
name: 'RudderLabs JavaScript SDK',
namespace: 'com.rudderlabs.javascript',
version: '1.0.0',
},
library: {
name: 'RudderLabs JavaScript SDK',
version: '1.0.0',
},
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
locale: 'en-US',
ip: '0.0.0.0',
os: {
name: '',
version: '',
},
screen: {
density: 2,
},
},
messageId: '84e26acc-56a5-4835-8233-591137fca468',
session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22',
originalTimestamp: '2019-10-14T09:03:17.562Z',
anonymousId: 'anon_id',
type: 'identify',
traits: {
email: '[email protected]',
name: 'Cosmo Krammer',
linkedinUrl: 'https://linkedin.com/cosmo-krammer',
location: 'New York',
emailOptOut: true,
masterAvatarTypeCode: 10,
},
integrations: {
All: true,
},
sentAt: '2019-10-14T09:03:22.563Z',
},
},
{
destination: {
Config: {
triggerType: 'Http',
apiKeyId: 'randomAPI',
enableBatchInput: true,
googleCloudFunctionUrl:
'https://us-central1-big-query-integration-poc.cloudfunctions.net/rohitv1',
maxBatchSize: '2',
},
},
metadata: {
jobId: '3',
},
message: {
channel: 'web',
context: {
app: {
build: '1.0.0',
name: 'RudderLabs JavaScript SDK',
namespace: 'com.rudderlabs.javascript',
version: '1.0.0',
},
library: {
name: 'RudderLabs JavaScript SDK',
version: '1.0.0',
},
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
locale: 'en-US',
ip: '0.0.0.0',
os: {
name: '',
version: '',
},
screen: {
density: 2,
},
},
messageId: '84e26acc-56a5-4835-8233-591137fca468',
session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22',
originalTimestamp: '2019-10-14T09:03:17.562Z',
anonymousId: 'anon_id',
type: 'identify',
traits: {
email: '[email protected]',
name: 'Cosmo Krammer',
linkedinUrl: 'https://linkedin.com/cosmo-krammer',
location: 'New York',
emailOptOut: true,
masterAvatarTypeCode: 10,
},
integrations: {
All: true,
},
sentAt: '2019-10-14T09:03:22.563Z',
},
},
],
destType: 'google_cloud_function',
},
},
},
output: {
response: {
status: 200,
body: {
output: [
{
batchedRequest: {
version: '1',
type: 'REST',
method: 'POST',
endpoint:
'https://us-central1-big-query-integration-poc.cloudfunctions.net/rohitv1',
headers: {
'content-type': 'application/json',
ApiKey: 'Basic YXBpS2V5OnJhbmRvbUFQSQ==',
},
params: {},
body: {
JSON: {},
JSON_ARRAY: {
batch:
'[{"channel":"web","context":{"app":{"build":"1.0.0","name":"RudderLabs JavaScript SDK","namespace":"com.rudderlabs.javascript","version":"1.0.0"},"library":{"name":"RudderLabs JavaScript SDK","version":"1.0.0"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36","locale":"en-US","ip":"0.0.0.0","os":{"name":"","version":""},"screen":{"density":2}},"messageId":"84e26acc-56a5-4835-8233-591137fca468","session_id":"3049dc4c-5a95-4ccd-a3e7-d74a7e411f22","originalTimestamp":"2019-10-14T09:03:17.562Z","anonymousId":"anon_id","type":"identify","traits":{"email":"[email protected]","name":"Cosmo Krammer","linkedinUrl":"https://linkedin.com/cosmo-krammer","location":"New York","emailOptOut":true,"masterAvatarTypeCode":10},"integrations":{"All":true},"sentAt":"2019-10-14T09:03:22.563Z"},{"channel":"web","context":{"app":{"build":"1.0.0","name":"RudderLabs JavaScript SDK","namespace":"com.rudderlabs.javascript","version":"1.0.0"},"library":{"name":"RudderLabs JavaScript SDK","version":"1.0.0"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36","locale":"en-US","ip":"0.0.0.0","os":{"name":"","version":""},"screen":{"density":2}},"messageId":"84e26acc-56a5-4835-8233-591137fca468","session_id":"3049dc4c-5a95-4ccd-a3e7-d74a7e411f22","originalTimestamp":"2019-10-14T09:03:17.562Z","anonymousId":"anon_id","type":"identify","traits":{"email":"[email protected]","name":"Cosmo Krammer","linkedinUrl":"https://linkedin.com/cosmo-krammer","location":"New York","emailOptOut":true,"masterAvatarTypeCode":10},"integrations":{"All":true},"sentAt":"2019-10-14T09:03:22.563Z"}]',
},
XML: {},
FORM: {},
},
files: {},
},
metadata: [{ jobId: '1' }, { jobId: '3' }],
batched: true,
statusCode: 200,
destination: {
Config: {
triggerType: 'Http',
apiKeyId: 'randomAPI',
enableBatchInput: true,
googleCloudFunctionUrl:
'https://us-central1-big-query-integration-poc.cloudfunctions.net/rohitv1',
maxBatchSize: '2',
},
},
},
{
destination: {
Config: {
triggerType: 'Http',
apiKeyId: 'randomAPI',
enableBatchInput: true,
googleCloudFunctionUrl: '',
maxBatchSize: '2',
},
},
metadata: [{ jobId: '2' }],
batched: false,
statusCode: 400,
error: '[GCF]:: Url not found. Aborting',
statTags: {
"destType": "GOOGLE_CLOUD_FUNCTION",
errorCategory: 'dataValidation',
errorType: 'configuration',
"feature": "router",
"implementation": "native",
"module": "destination",
},
},
],
},
},
},
},
];

0 comments on commit e564f80

Please sign in to comment.