Skip to content

Commit 370fc7b

Browse files
authored
clean up shared-resources (#2263)
* move shared-resources into packages folder * remove what is not necessary * run ecr viewer every time a shared serouce is updated * fix imports * setup tests * add github actions for package shared resources * remove all unused dependencies * change directory to packages for github aciton * install jest jsdom * fix yaml import * install testing-library for shared-resources * add AccordionContainer tests
1 parent 174c345 commit 370fc7b

File tree

22 files changed

+527
-3556
lines changed

22 files changed

+527
-3556
lines changed

.github/workflows/container-ecr-viewer.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "**"
77
paths:
88
- containers/ecr-viewer/**
9+
- packages/**
910
merge_group:
1011
types:
1112
- checks_requested
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Test package shared resources
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "**"
7+
paths:
8+
- packages/shared-resources/**
9+
merge_group:
10+
types:
11+
- checks_requested
12+
push:
13+
branches:
14+
- main
15+
paths-ignore:
16+
- pyproject.toml
17+
workflow_dispatch:
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
env:
24+
CONTAINER: shared-resources
25+
NODE_VERSION: 18 # Adjust the Node.js version as needed
26+
27+
jobs:
28+
javascript-linting:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Lint javascript for ${{env.CONTAINER}}
33+
working-directory: ./packages/${{env.CONTAINER}}
34+
run: |
35+
npm ci
36+
npm run lint
37+
test-node-containers:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
- name: Set up Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: ${{env.NODE_VERSION}}
46+
- name: Install dependencies
47+
working-directory: ./packages/${{env.CONTAINER}} # Navigate to your Node.js app directory
48+
run: npm install
49+
- name: Run tests
50+
working-directory: ./packages/${{env.CONTAINER}} # Navigate to your Node.js app directory
51+
run: npm test

containers/ecr-viewer/src/app/tests/components/ActiveProblems.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import { render, screen } from "@testing-library/react";
22
import { axe } from "jest-axe";
33
import fs from "fs";
4-
import YAML from "yaml";
4+
import YAML from "js-yaml";
55
import { Bundle, Condition } from "fhir/r4";
66
import BundleWithPatient from "@/app/tests/assets/BundlePatient.json";
77
import { returnProblemsTable } from "@/app/view-data/components/common";
8+
import { PathMappings } from "@/app/utils";
89

910
describe("Active Problems Table", () => {
1011
let container: HTMLElement;
1112
beforeEach(() => {
1213
const fhirPathFile = fs
1314
.readFileSync("./src/app/api/fhirPath.yml", "utf8")
1415
.toString();
15-
const fhirPathMappings = YAML.parse(fhirPathFile);
16+
const fhirPathMappings = YAML.load(fhirPathFile) as PathMappings;
1617

1718
const activeProblemsData: Condition[] = [
1819
{

containers/ecr-viewer/src/app/tests/components/Immunizations.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import { render } from "@testing-library/react";
22
import { axe } from "jest-axe";
33
import fs from "fs";
4-
import YAML from "yaml";
4+
import YAML from "js-yaml";
55
import { Bundle, Immunization } from "fhir/r4";
66
import BundleClinicalInfo from "@/app/tests/assets/BundleClinicalInfo.json";
77
import { returnImmunizations } from "@/app/view-data/components/common";
8+
import { PathMappings } from "@/app/utils";
89

910
describe("Immunizations Table", () => {
1011
let container: HTMLElement;
1112
beforeAll(() => {
1213
const fhirPathFile = fs
1314
.readFileSync("./src/app/api/fhirPath.yml", "utf8")
1415
.toString();
15-
const fhirPathMappings = YAML.parse(fhirPathFile);
16+
const fhirPathMappings = YAML.load(fhirPathFile) as PathMappings;
1617

1718
const immunizationsData = [
1819
{

0 commit comments

Comments
 (0)