Skip to content

Improve telemetry-api test coverage with separate unit/integration suites#23

Merged
tot-ra merged 1 commit intomainfrom
codex/telemetry-tests-suites-ci
Mar 3, 2026
Merged

Improve telemetry-api test coverage with separate unit/integration suites#23
tot-ra merged 1 commit intomainfrom
codex/telemetry-tests-suites-ci

Conversation

@tot-ra
Copy link
Contributor

@tot-ra tot-ra commented Mar 3, 2026

Summary\n- add a dedicated unit test suite under (controllers, auth middleware, resolvers, error model)\n- keep integration tests as a separate suite under \n- update npm scripts to run unit and integration suites separately\n- split GitHub Actions test workflow into separate unit and integration jobs\n- make integration API host configurable and harden global setup wait\n- add #1 [internal] load local bake definitions

#1 reading from stdin 573B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 149B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/platformatic/node-caged:25-slim
#3 DONE 0.0s

#4 [internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s

#5 [1/5] FROM docker.io/platformatic/node-caged:25-slim
#5 DONE 0.0s

#6 [internal] load build context
#6 transferring context: 1.19MB 0.7s done
#6 DONE 0.8s

#7 [2/5] WORKDIR /app
#7 CACHED

#8 [3/5] COPY . /app/
#8 DONE 6.0s

#9 [4/5] RUN npm install
#9 2.435
#9 2.435 removed 1 package, and audited 505 packages in 2s
#9 2.435
#9 2.435 61 packages are looking for funding
#9 2.435 run npm fund for details
#9 2.441
#9 2.441 4 vulnerabilities (1 low, 1 moderate, 2 high)
#9 2.441
#9 2.441 To address issues that do not require attention, run:
#9 2.441 npm audit fix
#9 2.441
#9 2.441 To address all issues (including breaking changes), run:
#9 2.441 npm audit fix --force
#9 2.441
#9 2.441 Run npm audit for details.
#9 2.443 npm notice
#9 2.443 npm notice New minor version of npm available! 11.9.0 -> 11.11.0
#9 2.443 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.11.0
#9 2.443 npm notice To update run: npm install -g npm@11.11.0
#9 2.443 npm notice
#9 DONE 2.6s

#10 [5/5] RUN npm run build
#10 0.258
#10 0.258 > telemetry-api@1.0.0 build
#10 0.258 > tsc -p ./src/config/tsconfig.json
#10 0.258
#10 DONE 1.1s

#11 exporting to image
#11 exporting layers
#11 exporting layers 0.8s done
#11 writing image sha256:c6ff6fd922cc713d0e2e8fe1cecc50bb622952408a3dbb9b82ec69344d6b1ef8 done
#11 naming to docker.io/library/telemetry-api-telemetry-api done
#11 DONE 0.8s

#12 resolving provenance for metadata file
#12 DONE 0.0s

telemetry-api@1.0.0 test:unit
./node_modules/.bin/jest --config ./test/unit/jest.config.json --detectOpenHandles --forceExit

-----------------------|---------|----------|---------|---------|---------------------------------------------

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 72.78 67.44 65.21 72.61
src 53.84 33.33 52.94 53.33
error.ts 100 100 100 100
resolvers.ts 48.78 33.33 50 48.78 26,34,56,74-136,144,157-162,180,187,203-208
src/controllers 94.73 92.3 100 94.73
entrance-movement.ts 90.47 86.66 100 90.47 14,21
iot-metrics.ts 100 100 100 100
src/middleware 95 85.18 100 95
auth.ts 95 85.18 100 95 82,107
----------------------- --------- ---------- --------- --------- ---------------------------------------------

telemetry-api@1.0.0 test:integration
./node_modules/.bin/jest --config ./test/integration/jest.coverage.json --detectOpenHandles --forceExit

Waiting for server to be ready at http://localhost:8600/health...
Still waiting for server... (1/180)
Still waiting for server... (2/180)
Still waiting for server... (3/180)
Still waiting for server... (4/180)
Server is ready! recipe to start test stack, run unit + integration tests, and always tear down\n- ignore generated coverage/test artifacts in \n\n## Validation\n-

telemetry-api@1.0.0 test:unit
./node_modules/.bin/jest --config ./test/unit/jest.config.json --detectOpenHandles --forceExit

-----------------------|---------|----------|---------|---------|---------------------------------------------

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 72.78 67.44 65.21 72.61
src 53.84 33.33 52.94 53.33
error.ts 100 100 100 100
resolvers.ts 48.78 33.33 50 48.78 26,34,56,74-136,144,157-162,180,187,203-208
src/controllers 94.73 92.3 100 94.73
entrance-movement.ts 90.47 86.66 100 90.47 14,21
iot-metrics.ts 100 100 100 100
src/middleware 95 85.18 100 95
auth.ts 95 85.18 100 95 82,107
----------------------- --------- ---------- --------- --------- ---------------------------------------------\n-

telemetry-api@1.0.0 test:integration
./node_modules/.bin/jest --config ./test/integration/jest.coverage.json --detectOpenHandles --forceExit --listTests

/Users/artjom/git/gratheon/telemetry-api/test/integration/generate-population-data.test.ts
/Users/artjom/git/gratheon/telemetry-api/test/integration/entrance-movement.test.ts
/Users/artjom/git/gratheon/telemetry-api/test/integration/iot-metrics.test.ts
/Users/artjom/git/gratheon/telemetry-api/test/integration/population-metrics.test.ts
/Users/artjom/git/gratheon/telemetry-api/test/integration/graphql.test.ts\n- #1 [internal] load local bake definitions
#1 reading from stdin 573B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 149B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/platformatic/node-caged:25-slim
#3 DONE 0.0s

#4 [internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s

#5 [1/5] FROM docker.io/platformatic/node-caged:25-slim
#5 DONE 0.0s

#6 [internal] load build context
#6 transferring context: 1.17MB 0.4s done
#6 DONE 0.5s

#7 [2/5] WORKDIR /app
#7 CACHED

#8 [3/5] COPY . /app/
#8 DONE 3.1s

#9 [4/5] RUN npm install
#9 2.620
#9 2.620 removed 1 package, and audited 505 packages in 2s
#9 2.621
#9 2.621 61 packages are looking for funding
#9 2.621 run npm fund for details
#9 2.626
#9 2.626 4 vulnerabilities (1 low, 1 moderate, 2 high)
#9 2.626
#9 2.626 To address issues that do not require attention, run:
#9 2.626 npm audit fix
#9 2.626
#9 2.626 To address all issues (including breaking changes), run:
#9 2.626 npm audit fix --force
#9 2.626
#9 2.626 Run npm audit for details.
#9 2.627 npm notice
#9 2.627 npm notice New minor version of npm available! 11.9.0 -> 11.11.0
#9 2.627 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.11.0
#9 2.627 npm notice To update run: npm install -g npm@11.11.0
#9 2.627 npm notice
#9 DONE 2.8s

#10 [5/5] RUN npm run build
#10 0.217
#10 0.217 > telemetry-api@1.0.0 build
#10 0.217 > tsc -p ./src/config/tsconfig.json
#10 0.217
#10 DONE 1.0s

#11 exporting to image
#11 exporting layers
#11 exporting layers 0.6s done
#11 writing image sha256:f4a955d5f728d72ad069a3e8add7787c16fa3c92a9eccc644ba067bd0c349024 done
#11 naming to docker.io/library/telemetry-api-telemetry-api done
#11 DONE 0.6s

#12 resolving provenance for metadata file
#12 DONE 0.0s

telemetry-api@1.0.0 test:unit
./node_modules/.bin/jest --config ./test/unit/jest.config.json --detectOpenHandles --forceExit

-----------------------|---------|----------|---------|---------|---------------------------------------------

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 72.78 67.44 65.21 72.61
src 53.84 33.33 52.94 53.33
error.ts 100 100 100 100
resolvers.ts 48.78 33.33 50 48.78 26,34,56,74-136,144,157-162,180,187,203-208
src/controllers 94.73 92.3 100 94.73
entrance-movement.ts 90.47 86.66 100 90.47 14,21
iot-metrics.ts 100 100 100 100
src/middleware 95 85.18 100 95
auth.ts 95 85.18 100 95 82,107
----------------------- --------- ---------- --------- --------- ---------------------------------------------

telemetry-api@1.0.0 test:integration
./node_modules/.bin/jest --config ./test/integration/jest.coverage.json --detectOpenHandles --forceExit

Waiting for server to be ready at http://localhost:8600/health...
Still waiting for server... (1/180)
Still waiting for server... (2/180)
Still waiting for server... (3/180)
Still waiting for server... (4/180)
Server is ready!\n

@tot-ra tot-ra merged commit 9362265 into main Mar 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant