Generating Mock CSV Data with faker.js

Faker.js is a neat little package that gives you a tonne of methods for generating various forms of fake data, from names and phone numbers to bitcoinAddresses. It's really simple to use and even supports multiple languages.

Recently I was writing some tests as part of a project I was working on and needed to generate some fake CSV data. The test was for a flow that begins with a CSV file,parses the file and stores some of that parsed data into a DynamoDB table in AWS. So I needed to be able to check that the value in a specific column of the CSV file end up in a specific field in the DB. I wrote a little class to help me achieve this that I thought I would share here in case anyone needs something similar: