Skip to content

Latest commit

 

History

History
75 lines (48 loc) · 1.6 KB

README.md

File metadata and controls

75 lines (48 loc) · 1.6 KB

NPM version npm module downloads per month InteractiveAdvertisingBureau

@iabtcf/testing

Testing tools to generate randomized input/output

Installation

npm

npm install @iabtcf/testing --save-dev

yarn

yarn add -D @iabtcf/testing

Utilities

TCModelFactory

Generate random TCModel with GVL

import {TCModelFactory} from '@iabtcf/testing';

const tcModel = TCModelFactory.withGVL();

Generate random TC string

import {TCString} from '@iabtcf/core';
import {TCModelFactory} from '@iabtcf/testing';

console.log(TCString.encode(TCModelFactory.noGVL()));
// ... random tc string

Add publisher restrictions

import {TCModelFactory} from '@iabtcf/testing';
let tcModel = TCModelFactory.withGVL();
tcModel = TCModelFactory.addPublisherRestrictions(tcModel);
// now has random publisher restrictions

GVLFactory

Get latest GVL

import {GVLFactory} from '@iabtcf/testing';
import {GVL} from '@iabtcf/core';

const gvl = GVLFactory.getLatest();

Get version of GVL

import {GVLFactory} from '@iabtcf/testing';
import {GVL} from '@iabtcf/core';

const gvl = GVLFactory.getVersion(10);