Skip to content

eliottp-git/mtb_event_testing

Repository files navigation

MTB Events Testing Tool

A simple Node.js tool that validates JSON data against predefined parameters. Perfect for checking if your data contains all the required fields for ecommerce events.

What This Tool Does

This tool helps you verify that your JSON data contains all the parameters defined in your conditions file. It's like a checklist that automatically checks if your data has all the required fields.

Prerequisites

Before you start, make sure you have these installed on your computer:

1. Node.js

  • What it is: A JavaScript runtime that lets you run JavaScript outside of a web browser
  • How to install:
    • Go to nodejs.org
    • Download the "LTS" version (recommended for most users)
    • Run the installer and follow the instructions
  • How to check if it's installed: Open your terminal/command prompt and type node --version

How to Get Started

Step 1: Download the Project

git clone https://github.com/eliottp-git/mtb_event_testing.git
cd mtb_event_testing

Step 2: Install Dependencies

npm install

What this does: Downloads all the required packages (like lodash) that the project needs to work.

Step 3: Run the Tool

npm start

What this does: Runs the validation tool and shows you which parameters are found or missing in your data.

Understanding the Files

📄 data.json

  • What it is: Your test data (the JSON object you want to check)
  • What to do: Replace this with your the JSON object returned from the dataLayer
  • An example is provided

�� conditions.js

  • What it is: Defines all the parameters that should exist in your data
  • What to do: Add or remove parameters as needed (each line starting with $ is a parameter). Copy paste the content of the parameter requirements in between the `` quotes
  • An example is provided

📄 index.js

  • What it is: The main logic that does the validation
  • What to do: You usually don't need to modify this unless you want to add new features

Example Output

When you run the tool, you'll see something like this:

Description of your image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published