Skip to content

Commit

Permalink
Added adlib test #508
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTschudi committed Oct 20, 2020
1 parent 2c7f303 commit ffadd74
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/common/test/templatization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,21 @@ describe("Module `templatization`: common functions involving the adlib library"
);
expect(actual).toEqual(expected);
});

it("should handle missing variables", () => {
const template = "{{organization.name||My Community}}<br />{{organization.nonexistantproperty.sharedTheme.logo.small||https://www.arcgis.com/sharing/rest/content/items/28989a5ecc2d4b2fbf62ac0f5075b7ff/data}}<br />{{organization.name||My Community}}";
const templateDictionary: any = {
organization: {
name: "myOrg"
}
};
const expected = "myOrg<br />https://www.arcgis.com/sharing/rest/content/items/28989a5ecc2d4b2fbf62ac0f5075b7ff/data<br />myOrg";
const actual: any = templatization.replaceInTemplate(
template,
templateDictionary
);
expect(actual).toEqual(expected);
});
});

describe("replaceTemplate", () => {
Expand Down

0 comments on commit ffadd74

Please sign in to comment.