From 208df8ae0ccd54854989d890c9c89771f2206264 Mon Sep 17 00:00:00 2001 From: Daniel Taraschi Date: Mon, 13 Nov 2023 15:55:52 -0500 Subject: [PATCH] Fix decodeSection function --- modules/cmpapi/src/encoder/GppModel.ts | 1 + modules/cmpapi/test/GppModel.test.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/modules/cmpapi/src/encoder/GppModel.ts b/modules/cmpapi/src/encoder/GppModel.ts index a8e8662..3b4394b 100644 --- a/modules/cmpapi/src/encoder/GppModel.ts +++ b/modules/cmpapi/src/encoder/GppModel.ts @@ -373,6 +373,7 @@ export class GppModel { if (section) { section.decode(encodedString); + this.dirty = true; } } diff --git a/modules/cmpapi/test/GppModel.test.ts b/modules/cmpapi/test/GppModel.test.ts index 3e4d0b1..a1fc1dd 100644 --- a/modules/cmpapi/test/GppModel.test.ts +++ b/modules/cmpapi/test/GppModel.test.ts @@ -709,4 +709,14 @@ describe("manifest.GppModel", (): void => { expect(decodedModel.getFieldValue("tcfeuv2", "VendorConsents")).to.eql([21, 32, 81, 128, 173, 210, 238, 755]); }); + + it("should let us decode a section string, and encode correctly", (): void => { + const gppModel = new GppModel(); + + gppModel.decodeSectionById(6, "1YNN") + + const gppString = gppModel.encode(); + + expect(gppString).to.eql("DBABTA~1YNN") + }) });