UnoCode A/B Testing (UnoAB)
Run A/B tests on your UnoCode Project.
Instalation
You can install UnoAB via npm:
npm install --save @unocode/ab
Usage
import UnoAB from '@unocode/ab';
const ab = new UnoAB();
ab.addTest(() => { console.log('I am test A!'); });
ab.addTest(() => { console.log('I am test B!'); });
ab.run();
ab.hasFired // true
ab.codeFired // returns the function that was executed
Persisting or Not Persisting
By default, UnoAB persists the function call, so only different users will experience different tests. You can disable this (and let user receive a new test on each run) as follows:
import UnoAB from '@unocode/ab';
const ab = new UnoAB({ persist: false });
ab.addTest(() => { console.log('I am test A!'); });
ab.addTest(() => { console.log('I am test B!'); });
ab.run();