InteractiveAdvertisingBureau/iabtcf-es

Testing helper TCModelFactory doesn't work anymore.

Opened this issue · 0 comments

Module
@iabtechlabtcf/testing

Version
1.5.9

Description
With the new GVL v3 (TCF 2.2) support, TCModelFactory stopped working.

Functions TCModelFactory.noGVL(); and TCModelFactory.withGVL(); throw the following error:
Error: Cannot find module './vendorlist/v2/vendor-list.json' from 'node_modules/@iabtechlabtcf/testing/lib/cjs/GVLFactory.js'

The reason is that TCModelFactory uses GVLFactory.getLatest() inside which calls the GVL resource with schema value of "v2" and for "v2" there's no latest vendor list json (./vendorlist/v2/vendor-list.json). This only works with "v2.2" passed as a schema parameter in GVLFactory.getLatest("v2.2").

The solution would be to change the default behaviour or add schema or any other parameters to the TCModelFactory functions.

I worked around this issue by manually creating TCModel and attaching gvl with GVLFactory.getLatest("v2.2") but I thought it's worth reporting that TCModelFactory is broken with the TCF 2.2 updates.