Skip to content

Commit

Permalink
Allow pa.gov domain (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarlandian committed May 19, 2021
1 parent 8b36ce1 commit b0e5122
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spotlight-client/src/DataStore/utils.test.ts
Expand Up @@ -40,10 +40,12 @@ test("*.nd.gov matches ND", () => {
expect(getTenantFromDomain).toThrow();
});

test("other .gov domains error", () => {
jsdom.reconfigure({ url: "https://dashboard.pa.gov" });
expect(getTenantFromDomain).toThrow();
test("*.pa.gov matches PA", () => {
jsdom.reconfigure({ url: "https://dashboard.cor.pa.gov" });
expect(getTenantFromDomain()).toBe("US_PA");
});

test("other .gov domains error", () => {
jsdom.reconfigure({ url: "https://dashboard.ca.gov" });
expect(getTenantFromDomain).toThrow();

Expand All @@ -57,6 +59,9 @@ test("other .gov domains error", () => {
test("staging domains matching tenants", () => {
jsdom.reconfigure({ url: "https://us-nd.spotlight-staging.recidiviz.org" });
expect(getTenantFromDomain()).toBe("US_ND");

jsdom.reconfigure({ url: "https://us-pa.spotlight-staging.recidiviz.org" });
expect(getTenantFromDomain()).toBe("US_PA");
});

test("no match", () => {
Expand Down
3 changes: 3 additions & 0 deletions spotlight-client/src/DataStore/utils.ts
Expand Up @@ -32,6 +32,9 @@ export function getTenantFromDomain(): TenantId | undefined {
if (domain.endsWith(".nd.gov")) {
return "US_ND";
}
if (domain.endsWith(".pa.gov")) {
return "US_PA";
}
throw new Error("Unable to proceed; this .gov domain is not supported.");
}

Expand Down

0 comments on commit b0e5122

Please sign in to comment.