Test / Demo Data Generation for Connect
Overview
Use an object as a template to generate batches of data with random values to push into Connect collection. Below describes how to use it in conjuction with the excellent Chance library.
Installation
npm install chancenpm install connect-test-data-generator
Example Usage
The example below generates random values for 1001 events. These events will have:
- A random string for 'name'.
- A random boolean for 'isPending'.
- A random string for 'type.description'.
- The number 3 for 'type.code'
- A random integer for 'status'.
- An array with exactly 3 random strings for 'tags'
"use strict"let chance = generator = ; let chance; let template = name: randomString chance type: description: randomString code: 3 chance tags: randomString randomString randomString let options = collectionName: 'my-test-collection' numbeOfEventsToPush: 1001 { console; } { console; } ; let connectConfig = projectId: 'YOUR_PROJECT_ID' apiKey: 'YOUR_PUSH_KEY'; generator;