diff --git a/.editorconfig b/.editorconfig index b4e30165..6f2f4eb0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,4 +10,8 @@ trim_trailing_whitespace = true [*.md] max_line_length = off -trim_trailing_whitespace = false \ No newline at end of file +trim_trailing_whitespace = false + +[{Makefile,**.mk}] +# Use tabs for indentation (Makefiles require tabs) +indent_style = tab diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index dc9b3e18..dfc5bf17 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -27,10 +27,10 @@ jobs: deploy-dev: runs-on: ubuntu-latest concurrency: - group: ${{ github.event.repository.name }}-dev-aws + group: ${{ github.event.repository.name }}-dev-env cancel-in-progress: false environment: "AWS DEV" - name: Deploy to AWS DEV + name: Deploy to DEV needs: - test-unit steps: @@ -53,33 +53,12 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - - run: make deploy_dev + - name: Publish to AWS + run: make deploy_dev env: HUSKY: "0" - deploy-cf-pages-dev: - runs-on: ubuntu-latest - concurrency: - group: ${{ github.event.repository.name }}-dev-cf - cancel-in-progress: false - permissions: - contents: read - deployments: write - needs: - - test-unit - name: Deploy to Cloudflare Pages DEV - environment: "Cloudflare Pages" - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Node LTS - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Build - run: corepack enable && yarn && yarn run build - env: VITE_RUN_ENVIRONMENT: dev - - name: Publish + - name: Publish to Cloudflare uses: cloudflare/pages-action@v1 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} @@ -88,14 +67,14 @@ jobs: directory: dist_ui/ gitHubToken: ${{ secrets.GITHUB_TOKEN }} branch: main - test: + + test-dev: runs-on: ubuntu-latest name: Run Live Integration Tests needs: - deploy-dev - - deploy-cf-pages-dev concurrency: - group: ${{ github.event.repository.name }}-dev + group: ${{ github.event.repository.name }}-dev-env cancel-in-progress: false steps: - name: Set up Node diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 41bdeebd..e1ed9423 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest name: Run Unit Tests steps: - - name: Set up Node for testing + - name: Set up Node uses: actions/setup-node@v4 with: node-version: 20.x @@ -27,10 +27,10 @@ jobs: deploy-dev: runs-on: ubuntu-latest concurrency: - group: ${{ github.event.repository.name }}-dev-aws + group: ${{ github.event.repository.name }}-dev cancel-in-progress: false environment: "AWS DEV" - name: Deploy to AWS DEV + name: Deploy to DEV needs: - test-unit steps: @@ -53,33 +53,12 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - - run: make deploy_dev + - name: Publish to AWS + run: make deploy_dev env: HUSKY: "0" - deploy-cf-pages-dev: - runs-on: ubuntu-latest - concurrency: - group: ${{ github.event.repository.name }}-dev-cf - cancel-in-progress: false - permissions: - contents: read - deployments: write - needs: - - test-unit - name: Deploy to Cloudflare Pages DEV - environment: "Cloudflare Pages" - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Node LTS - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Build - run: corepack enable && yarn && yarn run build - env: VITE_RUN_ENVIRONMENT: dev - - name: Publish + - name: Publish to Cloudflare uses: cloudflare/pages-action@v1 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} @@ -87,17 +66,18 @@ jobs: projectName: management-ui-dev directory: dist_ui/ gitHubToken: ${{ secrets.GITHUB_TOKEN }} - test: + branch: main + + test-dev: runs-on: ubuntu-latest name: Run Live Integration Tests needs: - deploy-dev - - deploy-cf-pages-dev concurrency: group: ${{ github.event.repository.name }}-dev cancel-in-progress: false steps: - - name: Set up Node for testing + - name: Set up Node uses: actions/setup-node@v4 with: node-version: 20.x @@ -110,11 +90,12 @@ jobs: python-version: 3.11 - name: Run live testing run: make test_live_integration - deploy-aws-prod: + + deploy-prod: runs-on: ubuntu-latest - name: Deploy to AWS PROD + name: Deploy to Prod concurrency: - group: ${{ github.event.repository.name }}-prod-aws + group: ${{ github.event.repository.name }}-prod cancel-in-progress: false needs: - test @@ -139,33 +120,12 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - - run: make deploy_prod + - name: Publish to AWS + run: make deploy_prod env: HUSKY: "0" - deploy-cf-pages-prod: - runs-on: ubuntu-latest - needs: - - test - permissions: - contents: read - deployments: write - concurrency: - group: ${{ github.event.repository.name }}-prod-cf - cancel-in-progress: false - name: Deploy to Cloudflare Pages Prod - environment: "Cloudflare Pages" - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Node LTS - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Build - run: corepack enable && yarn && yarn run build - env: VITE_RUN_ENVIRONMENT: prod - - name: Publish + - name: Publish to Cloudflare uses: cloudflare/pages-action@v1 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} @@ -174,11 +134,12 @@ jobs: directory: dist_ui/ gitHubToken: ${{ secrets.GITHUB_TOKEN }} branch: main + health-check-prod: runs-on: ubuntu-latest name: Confirm services healthy needs: - - deploy-aws-prod + - deploy-prod concurrency: group: ${{ github.event.repository.name }}-prod cancel-in-progress: false diff --git a/Makefile b/Makefile index 86ac74fa..42fb0169 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,10 @@ region="us-east-1" # DO NOT CHANGE common_params = --no-confirm-changeset \ - --no-fail-on-empty-changeset \ - --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \ - --region $(region) \ - --stack-name $(application_key) \ + --no-fail-on-empty-changeset \ + --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \ + --region $(region) \ + --stack-name $(application_key) \ --tags "project=$(application_key)" "techlead=$(techlead)" \ --s3-prefix $(application_key) \ --resolve-s3 @@ -45,6 +45,7 @@ clean: rm -rf src/api/node_modules/ rm -rf src/ui/node_modules/ rm -rf dist/ + rm -rf dist_ui/ build: src/ cloudformation/ docs/ yarn -D @@ -54,7 +55,7 @@ build: src/ cloudformation/ docs/ local: yarn run dev -deploy_prod: check_account_prod build +deploy_prod: check_account_prod build aws sts get-caller-identity --query Account --output text sam deploy $(common_params) --parameter-overrides $(run_env)=prod $(set_application_prefix)=$(application_key) $(set_application_name)="$(application_name)" @@ -74,7 +75,7 @@ test_unit: install_test_deps yarn test:unit dev_health_check: - curl -f https://$(application_key).aws.qa.acmuiuc.org/api/v1/healthz + curl -f https://$(application_key).aws.qa.acmuiuc.org/api/v1/healthz && curl -f https://manage.qa.acmuiuc.org prod_health_check: - curl -f https://$(application_key).aws.acmuiuc.org/api/v1/healthz \ No newline at end of file + curl -f https://$(application_key).aws.acmuiuc.org/api/v1/healthz && curl -f https://manage.acm.illinois.edu diff --git a/package.json b/package.json index e4cbd95d..cc8eee7a 100644 --- a/package.json +++ b/package.json @@ -1,105 +1,105 @@ { - "name": "infra-core", - "version": "1.0.0", - "private": true, - "type": "module", - "workspaces": [ - "src/api", - "src/ui" - ], - "packageManager": "yarn@1.22.22", - "scripts": { - "build": "yarn workspaces run build && yarn lockfile-manage", - "dev": "concurrently --names 'api,ui' 'yarn workspace infra-core-api run dev' 'yarn workspace infra-core-ui run dev'", - "lockfile-manage": "synp --with-workspace --source-file yarn.lock && cp package-lock.json dist/ && cp package.json dist/ && rm package-lock.json", - "prettier": "yarn workspaces run prettier && prettier --check tests/**/*.ts", - "prettier:write": "yarn workspaces run prettier:write && prettier --write tests/**/*.ts", - "lint": "yarn workspaces run lint", - "prepare": "node .husky/install.mjs || true", - "typecheck": "yarn workspaces run typecheck", - "test:unit": "cross-env APPLICATION_KEY=infra-core-api vitest run tests/unit", - "test:unit-ui": "yarn test:unit --ui", - "test:unit-watch": "cross-env APPLICATION_KEY=infra-core-api vitest tests/unit", - "test:live": "cross-env APPLICATION_KEY=infra-core-api vitest tests/live", - "test:live-ui": "yarn test:live --ui" - }, - "dependencies": { - "@aws-sdk/client-dynamodb": "^3.624.0", - "@aws-sdk/client-secrets-manager": "^3.624.0", - "@aws-sdk/util-dynamodb": "^3.624.0", - "@azure/msal-node": "^2.16.1", - "@fastify/auth": "^5.0.1", - "@fastify/aws-lambda": "^5.0.0", - "@fastify/caching": "^9.0.1", - "@fastify/cors": "^10.0.1", - "@touch4it/ical-timezones": "^1.9.0", - "discord.js": "^14.15.3", - "dotenv": "^16.4.5", - "fastify": "^5.1.0", - "fastify-plugin": "^4.5.1", - "ical-generator": "^7.2.0", - "jsonwebtoken": "^9.0.2", - "jwks-rsa": "^3.1.0", - "moment": "^2.30.1", - "moment-timezone": "^0.5.45", - "pluralize": "^8.0.0", - "zod": "^3.23.8", - "zod-to-json-schema": "^3.23.2", - "zod-validation-error": "^3.3.1" - }, - "devDependencies": { - "@eslint/compat": "^1.1.1", - "@tsconfig/node20": "^20.1.4", - "@types/node": "^22.1.0", - "@types/pluralize": "^0.0.33", - "@types/react": "^18.3.3", - "@types/react-dom": "^18.3.0", - "@types/supertest": "^6.0.2", - "@typescript-eslint/eslint-plugin": "^8.0.1", - "@typescript-eslint/parser": "^8.0.1", - "@vitejs/plugin-react": "^4.3.1", - "@vitest/ui": "^2.0.5", - "aws-sdk-client-mock": "^4.0.1", - "concurrently": "^9.1.2", - "cross-env": "^7.0.3", - "esbuild": "^0.23.0", - "eslint": "^8.57.0", - "eslint-config-airbnb": "^19.0.4", - "eslint-config-airbnb-typescript": "^18.0.0", - "eslint-config-esnext": "^4.1.0", - "eslint-config-mantine": "^3.2.0", - "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsx-a11y": "^6.9.0", - "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-react": "^7.35.0", - "eslint-plugin-react-hooks": "^4.6.2", - "husky": "^9.1.4", - "identity-obj-proxy": "^3.0.0", - "jsdom": "^24.1.1", - "node-ical": "^0.18.0", - "postcss": "^8.4.41", - "postcss-preset-mantine": "^1.17.0", - "postcss-simple-vars": "^7.0.1", - "prettier": "^3.3.3", - "prop-types": "^15.8.1", - "request": "^2.88.2", - "storybook": "^8.2.8", - "storybook-dark-mode": "^4.0.2", - "stylelint": "^16.8.1", - "stylelint-config-standard-scss": "^13.1.0", - "supertest": "^7.0.0", - "synp": "^1.9.14", - "tsx": "^4.16.5", - "typescript": "^5.5.4", - "typescript-eslint": "^8.0.1", - "vite": "^5.4.0", - "vite-tsconfig-paths": "^5.0.1", - "vitest": "^2.0.5", - "yarn-upgrade-all": "^0.7.4" - }, - "resolutions": { - "pdfjs-dist": "^4.8.69" - } -} + "name": "infra-core", + "version": "1.0.0", + "private": true, + "type": "module", + "workspaces": [ + "src/api", + "src/ui" + ], + "packageManager": "yarn@1.22.22", + "scripts": { + "build": "yarn workspaces run build && yarn lockfile-manage", + "dev": "concurrently --names 'api,ui' 'yarn workspace infra-core-api run dev' 'yarn workspace infra-core-ui run dev'", + "lockfile-manage": "synp --with-workspace --source-file yarn.lock && cp package-lock.json dist/ && cp package.json dist/ && rm package-lock.json", + "prettier": "yarn workspaces run prettier && prettier --check tests/**/*.ts", + "prettier:write": "yarn workspaces run prettier:write && prettier --write tests/**/*.ts", + "lint": "yarn workspaces run lint", + "prepare": "node .husky/install.mjs || true", + "typecheck": "yarn workspaces run typecheck", + "test:unit": "vitest run tests/unit && yarn workspace infra-core-ui run test:unit", + "test:unit-ui": "yarn test:unit --ui", + "test:unit-watch": "vitest tests/unit", + "test:live": "vitest tests/live", + "test:live-ui": "yarn test:live --ui" + }, + "dependencies": { + "@aws-sdk/client-dynamodb": "^3.624.0", + "@aws-sdk/client-secrets-manager": "^3.624.0", + "@aws-sdk/util-dynamodb": "^3.624.0", + "@azure/msal-node": "^2.16.1", + "@fastify/auth": "^5.0.1", + "@fastify/aws-lambda": "^5.0.0", + "@fastify/caching": "^9.0.1", + "@fastify/cors": "^10.0.1", + "@touch4it/ical-timezones": "^1.9.0", + "discord.js": "^14.15.3", + "dotenv": "^16.4.5", + "fastify": "^5.1.0", + "fastify-plugin": "^4.5.1", + "ical-generator": "^7.2.0", + "jsonwebtoken": "^9.0.2", + "jwks-rsa": "^3.1.0", + "moment": "^2.30.1", + "moment-timezone": "^0.5.45", + "pluralize": "^8.0.0", + "zod": "^3.23.8", + "zod-to-json-schema": "^3.23.2", + "zod-validation-error": "^3.3.1" + }, + "devDependencies": { + "@eslint/compat": "^1.1.1", + "@tsconfig/node20": "^20.1.4", + "@types/node": "^22.1.0", + "@types/pluralize": "^0.0.33", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@types/supertest": "^6.0.2", + "@typescript-eslint/eslint-plugin": "^8.0.1", + "@typescript-eslint/parser": "^8.0.1", + "@vitejs/plugin-react": "^4.3.1", + "@vitest/ui": "^2.0.5", + "aws-sdk-client-mock": "^4.0.1", + "concurrently": "^9.1.2", + "cross-env": "^7.0.3", + "esbuild": "^0.23.0", + "eslint": "^8.57.0", + "eslint-config-airbnb": "^19.0.4", + "eslint-config-airbnb-typescript": "^18.0.0", + "eslint-config-esnext": "^4.1.0", + "eslint-config-mantine": "^3.2.0", + "eslint-config-prettier": "^9.1.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jsx-a11y": "^6.9.0", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-react": "^7.35.0", + "eslint-plugin-react-hooks": "^4.6.2", + "husky": "^9.1.4", + "identity-obj-proxy": "^3.0.0", + "jsdom": "^24.1.1", + "node-ical": "^0.18.0", + "postcss": "^8.4.41", + "postcss-preset-mantine": "^1.17.0", + "postcss-simple-vars": "^7.0.1", + "prettier": "^3.3.3", + "prop-types": "^15.8.1", + "request": "^2.88.2", + "storybook": "^8.2.8", + "storybook-dark-mode": "^4.0.2", + "stylelint": "^16.8.1", + "stylelint-config-standard-scss": "^13.1.0", + "supertest": "^7.0.0", + "synp": "^1.9.14", + "tsx": "^4.16.5", + "typescript": "^5.5.4", + "typescript-eslint": "^8.0.1", + "vite": "^5.4.0", + "vite-tsconfig-paths": "^5.0.1", + "vitest": "^2.0.5", + "yarn-upgrade-all": "^0.7.4" + }, + "resolutions": { + "pdfjs-dist": "^4.8.69" + } +} \ No newline at end of file diff --git a/src/ui/App.test.tsx b/src/ui/App.test.tsx new file mode 100644 index 00000000..4a2fc2a3 --- /dev/null +++ b/src/ui/App.test.tsx @@ -0,0 +1,44 @@ +import { render, screen } from '@testing-library/react'; +import App from './App'; + +describe('App', () => { + it('renders the App component and verifies the logo and text', () => { + render(); + + // Verify there are two instances of the logo + const logos = screen.getAllByAltText(/ACM Logo/i); // Assuming the alt text for the logo is "ACM Logo" + expect(logos).toHaveLength(2); + + // Verify the text "ACM@UIUC Management Portal" is present + const portalText = screen.getByText(/ACM@UIUC Management Portal/i); + expect(portalText).toBeInTheDocument(); + }); + + it('verifies the "Authorized Users Only" section', () => { + render(); + + // Verify the "Authorized Users Only" text is present + const authText = screen.getByText(/Authorized Users Only/i); + expect(authText).toBeInTheDocument(); + + // Verify the explanation text is present + const explanationText = screen.getByText(/Unauthorized or improper use or access/i); + expect(explanationText).toBeInTheDocument(); + }); + + it('verifies the "Sign in with Illinois NetID" button', () => { + render(); + + // Verify the button is present + const signInButton = screen.getByRole('button', { name: /Sign in with Illinois NetID/i }); + expect(signInButton).toBeInTheDocument(); + }); + + it('verifies the theme toggle is present', () => { + render(); + + // Verify the theme toggle is present + const themeToggle = screen.getByRole('switch'); // Assuming it uses a switch role + expect(themeToggle).toBeInTheDocument(); + }); +}); diff --git a/src/ui/components/Navbar/Logo.test.tsx b/src/ui/components/Navbar/Logo.test.tsx new file mode 100644 index 00000000..371e9f73 --- /dev/null +++ b/src/ui/components/Navbar/Logo.test.tsx @@ -0,0 +1,37 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; +import { vi } from 'vitest'; +import LogoBadge from './Logo'; + +describe('Logo basic tests', () => { + beforeEach(async () => { + vi.resetModules(); + }); + + it('renders the logo image', () => { + render( + + + + ); + const logo = screen.getByAltText('ACM Logo'); + expect(logo).toBeInTheDocument(); + const logoSrc = logo.getAttribute('src'); + expect(logo).toHaveStyle('height: 3em'); + expect(logoSrc).toEqual('/banner-blue.png'); + }); + + it('renders the red text "Management Portal DEV ENV" in the dev env', () => { + render( + + + + ); + + const text = screen.getByText('Management Portal DEV ENV'); + const style = window.getComputedStyle(text); + expect(text).toBeInTheDocument(); + expect(style.color).toBe('rgb(255, 0, 0)'); // Red in RGB format + }); +}); diff --git a/src/ui/components/Navbar/Logo.tsx b/src/ui/components/Navbar/Logo.tsx index 2a952c00..8c4632a5 100644 --- a/src/ui/components/Navbar/Logo.tsx +++ b/src/ui/components/Navbar/Logo.tsx @@ -12,7 +12,7 @@ interface LogoBadgeProps { showText?: boolean; } -const LogoBadge: React.FC = ({ size, linkTo, showText }) => { +export const LogoBadge: React.FC = ({ size, linkTo, showText }) => { const isNonProd = import.meta.env.VITE_RUN_ENVIRONMENT !== 'prod'; if (!showText) { showText = true; @@ -25,6 +25,7 @@ const LogoBadge: React.FC = ({ size, linkTo, showText }) => { key: 'acm-manage-color-scheme', defaultValue: preferredColorScheme, }); + const runEnv = import.meta.env.VITE_RUN_ENVIRONMENT; return ( = ({ size, linkTo, showText }) => { style={{ height: '3em', marginRight: '0.5em' }} /> {showText - ? isNonProd - ? `Management Portal ${import.meta.env.VITE_RUN_ENVIRONMENT.toUpperCase()} ENV` + ? isNonProd && runEnv + ? `Management Portal ${runEnv.toUpperCase()} ENV` : 'Management Portal' : null} diff --git a/src/ui/package.json b/src/ui/package.json index 58d28c89..5bbd9ebd 100644 --- a/src/ui/package.json +++ b/src/ui/package.json @@ -14,6 +14,7 @@ "vitest": "vitest run", "vitest:watch": "vitest", "test": "npm run typecheck && npm run prettier && npm run lint && npm run vitest && npm run build", + "test:unit": "yarn run vitest", "storybook": "storybook dev -p 6006", "storybook:build": "storybook build" }, @@ -91,4 +92,4 @@ "resolutions": { "pdfjs-dist": "4.5.136" } -} +} \ No newline at end of file diff --git a/src/ui/vite.config.mjs b/src/ui/vite.config.mjs index 550665f8..91ee6eea 100644 --- a/src/ui/vite.config.mjs +++ b/src/ui/vite.config.mjs @@ -19,6 +19,9 @@ export default defineConfig({ globals: true, environment: 'jsdom', setupFiles: './vitest.setup.mjs', + env: { + VITE_RUN_ENVIRONMENT: 'dev' + }, }, server: { historyApiFallback: true, diff --git a/src/ui/vitest.setup.mjs b/src/ui/vitest.setup.mjs index ac096dfd..a1650c2f 100644 --- a/src/ui/vitest.setup.mjs +++ b/src/ui/vitest.setup.mjs @@ -26,3 +26,28 @@ class ResizeObserver { } window.ResizeObserver = ResizeObserver; + +vi.mock('react-router-dom', async () => { + const actualRouter = await vi.importActual('react-router-dom'); + return { + ...actualRouter, // Retain all actual exports + useNavigate: vi.fn(() => vi.fn()), // Mock `useNavigate` + }; +}); + + +vi.mock('@mantine/hooks', async () => { + const rrdactual = await vi.importActual('react-router-dom'); + return { + ...rrdactual, + useLocalStorage: vi.fn().mockReturnValue(['light', vi.fn()]), + useColorScheme: vi.fn(() => 'light'), + useDisclosure: vi.fn(() => { + const state = { isOpen: false }; + const open = vi.fn(() => (state.isOpen = true)); + const close = vi.fn(() => (state.isOpen = false)); + const toggle = vi.fn(() => (state.isOpen = !state.isOpen)); + return [state.isOpen, { open, close, toggle }]; + }), + } +}); diff --git a/tests/live/events.test.ts b/tests/live/events.test.ts index 95a09f8d..879bb509 100644 --- a/tests/live/events.test.ts +++ b/tests/live/events.test.ts @@ -1,13 +1,7 @@ import { expect, test } from "vitest"; -import { InternalServerError } from "../../src/common/errors/index.js"; import { EventsGetResponse } from "../../src/api/routes/events.js"; -const appKey = process.env.APPLICATION_KEY; -if (!appKey) { - throw new InternalServerError({ message: "No application key found" }); -} - -const baseEndpoint = `https://${appKey}.aws.qa.acmuiuc.org`; +const baseEndpoint = `https://infra-core-api.aws.qa.acmuiuc.org`; test("getting events", async () => { const response = await fetch(`${baseEndpoint}/api/v1/events`); diff --git a/tests/live/healthz.test.ts b/tests/live/healthz.test.ts index 2d3238fe..5d317e89 100644 --- a/tests/live/healthz.test.ts +++ b/tests/live/healthz.test.ts @@ -1,12 +1,7 @@ import { expect, test } from "vitest"; import { InternalServerError } from "../../src/common/errors/index.js"; -const appKey = process.env.APPLICATION_KEY; -if (!appKey) { - throw new InternalServerError({ message: "No application key found" }); -} - -const baseEndpoint = `https://${appKey}.aws.qa.acmuiuc.org`; +const baseEndpoint = `https://infra-core-api.aws.qa.acmuiuc.org`; test("healthz", async () => { const response = await fetch(`${baseEndpoint}/api/v1/healthz`); diff --git a/tests/live/ical.test.ts b/tests/live/ical.test.ts index b723d0cc..b6b87e3f 100644 --- a/tests/live/ical.test.ts +++ b/tests/live/ical.test.ts @@ -4,12 +4,8 @@ import { describe } from "node:test"; import { OrganizationList } from "../../src/common/orgs.js"; import ical from "node-ical"; -const appKey = process.env.APPLICATION_KEY; -if (!appKey) { - throw new InternalServerError({ message: "No application key found" }); -} +const baseEndpoint = `https://infra-core-api.aws.qa.acmuiuc.org`; -const baseEndpoint = `https://${appKey}.aws.qa.acmuiuc.org`; test("getting all events", async () => { const response = await fetch(`${baseEndpoint}/api/v1/ical`); expect(response.status).toBe(200); diff --git a/tests/live/organizations.test.ts b/tests/live/organizations.test.ts index 3e078c64..b8aef2b2 100644 --- a/tests/live/organizations.test.ts +++ b/tests/live/organizations.test.ts @@ -1,12 +1,7 @@ import { expect, test } from "vitest"; import { InternalServerError } from "../../src/common/errors/index.js"; -const appKey = process.env.APPLICATION_KEY; -if (!appKey) { - throw new InternalServerError({ message: "No application key found" }); -} - -const baseEndpoint = `https://${appKey}.aws.qa.acmuiuc.org`; +const baseEndpoint = `https://infra-core-api.aws.qa.acmuiuc.org`; test("getting organizations", async () => { const response = await fetch(`${baseEndpoint}/api/v1/organizations`);