Skip to content

Commit

Permalink
Add Maine to Spotlight (#562)
Browse files Browse the repository at this point in the history
* Add Maine to Spotlight with bunk source data to start

* Update us_me.ts

* Update snapshot

* Add facilities and remove parole references

* Removed unused sections

* Add districts

* update TODO

* add docLink and docName
  • Loading branch information
terryttsai committed May 10, 2022
1 parent 6dc8552 commit 7167ce1
Show file tree
Hide file tree
Showing 9 changed files with 478 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
working-directory: spotlight-client
env:
REACT_APP_API_URL: http://localhost:3002
REACT_APP_ENABLED_TENANTS: US_ID,US_ND,US_PA,US_TN
REACT_APP_ENABLED_TENANTS: US_ID,US_ME,US_ND,US_PA,US_TN
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spotlight-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
REACT_APP_AUTH_ENABLED: true
REACT_APP_AUTH_ENV: development
REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL }}
REACT_APP_ENABLED_TENANTS: US_ID,US_ND,US_PA,US_TN
REACT_APP_ENABLED_TENANTS: US_ID,US_ME,US_ND,US_PA,US_TN

run: yarn build
- name: Store build artifact
Expand Down
3 changes: 3 additions & 0 deletions spotlight-client/src/DataStore/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ test("staging domains matching tenants", () => {
jsdom.reconfigure({ url: "https://us-id.spotlight-staging.recidiviz.org" });
expect(getTenantFromDomain()).toBe("US_ID");

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

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

Expand Down
1 change: 1 addition & 0 deletions spotlight-client/src/DataStore/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function getTenantFromDomain(): TenantId | undefined {
// production domains
if (domain.endsWith(".gov")) {
// TODO(#530): Add ID here
// TODO(#569): Add ME here
if (domain.endsWith(".nd.gov")) {
return "US_ND";
}
Expand Down
4 changes: 4 additions & 0 deletions spotlight-client/src/contentApi/getTenantList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ test("getTenantList", () => {
"id": "US_ID",
"name": "Idaho",
},
Object {
"id": "US_ME",
"name": "Maine",
},
Object {
"id": "US_ND",
"name": "North Dakota",
Expand Down
2 changes: 2 additions & 0 deletions spotlight-client/src/contentApi/retrieveContent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

import retrieveContent from "./retrieveContent";
import US_ID from "./sources/us_id";
import US_ME from "./sources/us_me";
import US_ND from "./sources/us_nd";
import US_PA from "./sources/us_pa";
import US_TN from "./sources/us_tn";

test("returns content for the specified tenant", () => {
expect(retrieveContent({ tenantId: "US_ID" })).toEqual(US_ID);
expect(retrieveContent({ tenantId: "US_ME" })).toEqual(US_ME);
expect(retrieveContent({ tenantId: "US_ND" })).toEqual(US_ND);
expect(retrieveContent({ tenantId: "US_PA" })).toEqual(US_PA);
expect(retrieveContent({ tenantId: "US_TN" })).toEqual(US_TN);
Expand Down
2 changes: 2 additions & 0 deletions spotlight-client/src/contentApi/retrieveContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import { ERROR_MESSAGES } from "../constants";
import { isTenantEnabled } from "./isTenantEnabled";
import US_ID from "./sources/us_id";
import US_ME from "./sources/us_me";
import US_ND from "./sources/us_nd";
import US_PA from "./sources/us_pa";
import US_TN from "./sources/us_tn";
import { TenantContent, TenantId } from "./types";

const CONTENT_SOURCES: Record<TenantId, TenantContent> = {
US_ID,
US_ME,
US_ND,
US_PA,
US_TN,
Expand Down
457 changes: 457 additions & 0 deletions spotlight-client/src/contentApi/sources/us_me.ts

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion spotlight-client/src/contentApi/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ export type LocalityLabels = {
// ============================
// Tenant types

export const TenantIdList = ["US_ID", "US_ND", "US_PA", "US_TN"] as const;
export const TenantIdList = [
"US_ID",
"US_ME",
"US_ND",
"US_PA",
"US_TN",
] as const;
export type TenantId = typeof TenantIdList[number];
export function isTenantId(x: string): x is TenantId {
return TenantIdList.includes(x as TenantId);
Expand Down

0 comments on commit 7167ce1

Please sign in to comment.