From 09572e3ee3ddb25847771b47bcc3d5d25561e911 Mon Sep 17 00:00:00 2001 From: shrouti1507 Date: Fri, 8 Sep 2023 16:54:38 +0530 Subject: [PATCH] fix: adding test cases --- .../destinations/bqstream/router/data.ts | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) diff --git a/test/integrations/destinations/bqstream/router/data.ts b/test/integrations/destinations/bqstream/router/data.ts index e746e0f8a4..c551dc21f4 100644 --- a/test/integrations/destinations/bqstream/router/data.ts +++ b/test/integrations/destinations/bqstream/router/data.ts @@ -171,6 +171,168 @@ export const data = [ Name: 'bqstream test', }, }, + { + message: { + type: 'identify', + event: 'insert product', + sentAt: '2021-09-08T11:10:45.466Z', + userId: 'user12345', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.18', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://127.0.0.1:5500/index.html', + path: '/index.html', + title: 'Document', + search: '', + tab_url: 'http://127.0.0.1:5500/index.html', + referrer: '$direct', + initial_referrer: '$direct', + referring_domain: '', + initial_referring_domain: '', + }, + locale: 'en-GB', + screen: { + width: 1536, + height: 960, + density: 2, + innerWidth: 1536, + innerHeight: 776, + }, + traits: {}, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.18', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36', + }, + rudderId: 'fa2994a5-2a81-45fd-9919-fcf5596ad380', + messageId: 'e2d1a383-d9a2-4e03-a9dc-131d153c4d95', + timestamp: '2021-11-15T14:06:42.497+05:30', + traits: { + count: 20, + productId: 20, + productName: 'Product-20', + }, + receivedAt: '2021-11-15T14:06:42.497+05:30', + request_ip: '[::1]', + anonymousId: 'd8b2ed61-7fa5-4ef8-bd92-6a506157c0cf', + integrations: { + All: true, + }, + originalTimestamp: '2021-09-08T11:10:45.466Z', + }, + metadata: { + jobId: 3, + userId: 'user12345', + }, + destination: { + Config: { + rudderAccountId: '1z8LpaSAuFR9TPWL6fECZfjmRa-', + projectId: 'gc-project-id', + datasetId: 'gc_dataset', + tableId: 'gc_table', + insertId: 'productId', + eventDelivery: true, + eventDeliveryTS: 1636965406397, + }, + Enabled: true, + ID: '1WXjIHpu7ETXgjfiGPW3kCUgZFR', + Name: 'bqstream test', + }, + }, + { + message: { + type: 'track', + event: 'insert product', + sentAt: '2021-09-08T11:10:45.466Z', + userId: 'user12345', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.18', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://127.0.0.1:5500/index.html', + path: '/index.html', + title: 'Document', + search: '', + tab_url: 'http://127.0.0.1:5500/index.html', + referrer: '$direct', + initial_referrer: '$direct', + referring_domain: '', + initial_referring_domain: '', + }, + locale: 'en-GB', + screen: { + width: 1536, + height: 960, + density: 2, + innerWidth: 1536, + innerHeight: 776, + }, + traits: {}, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.18', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36', + }, + rudderId: 'fa2994a5-2a81-45fd-9919-fcf5596ad380', + messageId: 'e2d1a383-d9a2-4e03-a9dc-131d153c4d95', + timestamp: '2021-11-15T14:06:42.497+05:30', + properties: { + count: 20, + productId: 20, + productName: 'Product-20', + }, + receivedAt: '2021-11-15T14:06:42.497+05:30', + request_ip: '[::1]', + anonymousId: 'd8b2ed61-7fa5-4ef8-bd92-6a506157c0cf', + integrations: { + All: true, + }, + originalTimestamp: '2021-09-08T11:10:45.466Z', + }, + metadata: { + jobId: 5, + userId: 'user123', + }, + destination: { + Config: { + rudderAccountId: '1z8LpaSAuFR9TPWL6fECZfjmRa-', + projectId: 'gc-project-id', + datasetId: 'gc_dataset', + tableId: 'gc_table', + insertId: 'productId', + eventDelivery: true, + eventDeliveryTS: 1636965406397, + }, + Enabled: true, + ID: '1WXjIHpu7ETXgjfiGPW3kCUgZFR', + Name: 'bqstream test', + }, + }, ], destType: 'bqstream', }, @@ -229,6 +391,76 @@ export const data = [ Name: 'bqstream test', }, }, + { + batched: false, + destination: { + Config: { + datasetId: 'gc_dataset', + eventDelivery: true, + eventDeliveryTS: 1636965406397, + insertId: 'productId', + projectId: 'gc-project-id', + rudderAccountId: '1z8LpaSAuFR9TPWL6fECZfjmRa-', + tableId: 'gc_table', + }, + Enabled: true, + ID: '1WXjIHpu7ETXgjfiGPW3kCUgZFR', + Name: 'bqstream test', + }, + error: 'Message Type not supported: identify', + metadata: [ + { + jobId: 3, + userId: 'user12345', + }, + ], + statTags: { + destType: 'BQSTREAM', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + { + batched: true, + batchedRequest: { + datasetId: 'gc_dataset', + projectId: 'gc-project-id', + properties: [ + { + count: 20, + insertId: '20', + productId: 20, + productName: 'Product-20', + }, + ], + tableId: 'gc_table', + }, + destination: { + Config: { + datasetId: 'gc_dataset', + eventDelivery: true, + eventDeliveryTS: 1636965406397, + insertId: 'productId', + projectId: 'gc-project-id', + rudderAccountId: '1z8LpaSAuFR9TPWL6fECZfjmRa-', + tableId: 'gc_table', + }, + Enabled: true, + ID: '1WXjIHpu7ETXgjfiGPW3kCUgZFR', + Name: 'bqstream test', + }, + metadata: [ + { + jobId: 5, + userId: 'user123', + }, + ], + statusCode: 200, + }, ], }, },