From 2e923ffcb2f922c633495458d98906f1e19f0a89 Mon Sep 17 00:00:00 2001 From: Gauravudia Date: Mon, 18 Sep 2023 21:03:24 +0530 Subject: [PATCH] test: add testcases --- src/v0/util/testdata/groupEventsByType.json | 636 +++++++++++++++++++- 1 file changed, 635 insertions(+), 1 deletion(-) diff --git a/src/v0/util/testdata/groupEventsByType.json b/src/v0/util/testdata/groupEventsByType.json index 73d45c7a1f..09155aa062 100644 --- a/src/v0/util/testdata/groupEventsByType.json +++ b/src/v0/util/testdata/groupEventsByType.json @@ -5,7 +5,7 @@ "output": [] }, { - "description": "Should group multiple events with the different message type and different users together in a batch", + "description": "Should group multiple events with the different message type and different users together in a batch: Scenario 1", "input": [ [ { @@ -53,6 +53,128 @@ "jobId": "5" } } + ], + [ + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + } ] ], "output": [ @@ -108,5 +230,517 @@ } ] ] + }, + { + "description": "Should group multiple events with the different message type and different users together in a batch: Scenario 2", + "input": [ + [ + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + } + ] + ], + "output": [ + [ + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + } + ], + [ + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "5" + } + } + ], + [ + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + } + ] + ] + }, + { + "description": "Should group multiple events with the different message type and different users together in a batch: Scenario 3", + "input": [ + [ + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + } + ] + ], + "output": [ + [ + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "4" + } + } + ], + [ + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "3" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "4" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + }, + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "6" + } + } + ], + [ + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "1" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "5" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + }, + { + "message": { + "type": "track" + }, + "metadata": { + "userId": "2" + } + } + ], + [ + { + "message": { + "type": "identify" + }, + "metadata": { + "userId": "5" + } + } + ] + ] } ]