From d603621a78782b424c1255d8b326d5289c9a233f Mon Sep 17 00:00:00 2001 From: "circleci-app[bot]" <127350680+circleci-app[bot]@users.noreply.github.com> Date: Sun, 5 Apr 2026 07:02:47 +0000 Subject: [PATCH 1/2] feat: apply code changes This commit introduces code changes or enhancements. Please see the diff for a complete list of modifications. --- .circleci/config.yml | 30 +++++++++++------------------- aq-dashboard/src/index.tsx | 1 - 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6229170..fdf3dfc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,30 +2,22 @@ # See: https://circleci.com/docs/configuration-reference version: 2.1 -# Define a job to be invoked later in a workflow. -# See: https://circleci.com/docs/jobs-steps/#jobs-overview & https://circleci.com/docs/configuration-reference/#jobs jobs: - say-hello: - # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. - # See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job + build: docker: - # Specify the version you desire here - # See: https://circleci.com/developer/images/image/cimg/base - - image: cimg/base:current - - # Add steps to the job - # See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps + - image: cimg/node:22.19 steps: - # Checkout the code as the first step. - checkout - run: - name: "Say hello" - command: "echo Hello, World!" + name: Install dependencies + command: npm ci --legacy-peer-deps + working_directory: aq-dashboard + - run: + name: Build + command: npm run build + working_directory: aq-dashboard -# Orchestrate jobs using workflows -# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows workflows: - say-hello-workflow: # This is the name of the workflow, feel free to change it to better match your workflow. - # Inside the workflow, you define the jobs you want to run. + build-workflow: jobs: - - say-hello \ No newline at end of file + - build diff --git a/aq-dashboard/src/index.tsx b/aq-dashboard/src/index.tsx index 0ee8b59..8724060 100644 --- a/aq-dashboard/src/index.tsx +++ b/aq-dashboard/src/index.tsx @@ -1,6 +1,5 @@ import { createRoot } from 'react-dom/client'; import React from 'react'; -import ReactDOM from 'react-dom/client'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; From e9347d64e18532c75588433e2bcc4728b9bc4633 Mon Sep 17 00:00:00 2001 From: "circleci-app[bot]" <127350680+circleci-app[bot]@users.noreply.github.com> Date: Sun, 5 Apr 2026 08:13:54 +0000 Subject: [PATCH 2/2] ci: add config validation job, test step, and App smoke tests ## Summary - **CircleCI config validation job**: Adds a new `validate-config` job that installs the CircleCI CLI and validates `.circleci/config.yml` syntax on every run. This job is wired into the `build-workflow` so it runs alongside the existing `build` job. - **Node orb**: Introduces the `circleci/node@6` orb to the pipeline configuration. - **Test step in build job**: Adds an explicit `npm test -- --watchAll=false --passWithNoTests` step to the `build` job so tests are executed as part of CI builds. - **App smoke tests**: Creates `aq-dashboard/src/App.test.tsx` with three tests that verify the `App` component renders without crashing, displays a "waiting for location" prompt while geolocation is pending, and shows a manual location entry button. Includes stubs for `navigator.geolocation`, `react-leaflet`, and `axios` to make the tests runnable in jsdom. ## Test plan - [ ] Confirm `validate-config` job passes on a valid config and fails on an invalid one - [ ] Confirm `npm test` runs and all three `App` smoke tests pass in CI - [ ] Verify the `build-workflow` runs both `validate-config` and `build` jobs --- .circleci/config.yml | 19 ++++++++++++++++ aq-dashboard/src/App.test.tsx | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 aq-dashboard/src/App.test.tsx diff --git a/.circleci/config.yml b/.circleci/config.yml index fdf3dfc..a3a8ba2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,21 @@ # See: https://circleci.com/docs/configuration-reference version: 2.1 +orbs: + node: circleci/node@6 + jobs: + validate-config: + docker: + - image: cimg/base:stable + steps: + - checkout + - run: + name: Validate CircleCI configuration syntax + command: | + curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | bash -s -- --no-sudo --install-dir /tmp/circleci-cli + /tmp/circleci-cli/circleci config validate .circleci/config.yml + build: docker: - image: cimg/node:22.19 @@ -16,8 +30,13 @@ jobs: name: Build command: npm run build working_directory: aq-dashboard + - run: + name: Test + command: npm test -- --watchAll=false --passWithNoTests + working_directory: aq-dashboard workflows: build-workflow: jobs: + - validate-config - build diff --git a/aq-dashboard/src/App.test.tsx b/aq-dashboard/src/App.test.tsx new file mode 100644 index 0000000..582a875 --- /dev/null +++ b/aq-dashboard/src/App.test.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import App from './App'; + +// Stub geolocation so Dashboard does not throw in jsdom +beforeEach(() => { + Object.defineProperty(global.navigator, 'geolocation', { + configurable: true, + value: { + getCurrentPosition: jest.fn(), + }, + }); +}); + +// Stub leaflet, which relies on a browser DOM unavailable in jsdom +jest.mock('react-leaflet', () => ({ + MapContainer: ({ children }: { children: React.ReactNode }) => ( +