Skip to content

Commit

Permalink
Add test case to verify that custom base url is respected when config…
Browse files Browse the repository at this point in the history
… json indicates redirect (#103)
  • Loading branch information
adams85 authored Apr 10, 2024
1 parent 547bc42 commit 916877d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/DataGovernanceTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,24 @@ describe("DataGovernance", () => {
configService.validateCall(1, customUrl);
});

it("sdk global, custom - should respect custom url when redirect is not forced", async () => {
// In this case
// the first invocation should call https://cdn-custom.configcat.com
// the second invocation should call https://cdn-custom.configcat.com
const configService = new FakeConfigServiceBase(DataGovernance.Global, customUrl);
configService.prepareResponse(customUrl, globalUrl, 1, null);

let [, config] = await configService.refreshLogicAsync();
assert.isNull(JSON.parse(config.configJson!)["f"]);
configService.validateCallCount(1);
configService.validateCall(0, customUrl);

[, config] = await configService.refreshLogicAsync();
assert.isNull(JSON.parse(config.configJson!)["f"]);
configService.validateCallCount(2);
configService.validateCall(1, customUrl);
});

it("sdk global, forced", async () => {
// In this case
// the first invocation should call https://cdn-global.configcat.com
Expand Down

0 comments on commit 916877d

Please sign in to comment.