diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dd54fc540..1357528fd 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/deploy-support.yml b/.github/workflows/deploy-support.yml index fc0be9c52..08a621fa2 100644 --- a/.github/workflows/deploy-support.yml +++ b/.github/workflows/deploy-support.yml @@ -20,7 +20,7 @@ jobs: else echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV fi - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Validate branch name run: ./.github/branchNameValidation.sh $STAGE_PREFIX$branch_name - name: set branch specific variable names @@ -34,7 +34,7 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} CODE_CLIMATE_ID: ${{ secrets.CODE_CLIMATE_ID }} - name: Configure AWS credentials for GitHub Actions - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }} aws-region: ${{ env.AWS_DEFAULT_REGION }} @@ -42,10 +42,10 @@ jobs: run: ./.github/github-lock.sh $branch_name env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v3 with: - node-version: "14.x" - - uses: actions/cache@v2 + node-version: "18.x" + - uses: actions/cache@v3 with: path: "**/node_modules" key: deploy-support-${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock', 'plugins/**') }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c552b22c9..9c7321eac 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,16 +18,16 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: "14.x" + node-version: "18.x" - name: Install dependencies run: | - npm ci + npm ci --legacy-peer-deps for service in services/*/; do pushd "$service" - if [ -f package-lock.json ]; then npm ci; fi + if [ -f package-lock.json ]; then npm ci --legacy-peer-deps; fi popd done - name: Run ESLint @@ -36,12 +36,12 @@ jobs: name: Unit Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: "14.x" + node-version: "18.x" - name: Unit Test & Publish Coverage - uses: paambaati/codeclimate-action@v2.7.5 + uses: paambaati/codeclimate-action@v5.0.0 env: CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }} with: @@ -81,7 +81,7 @@ jobs: """ exit 1 fi - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Validate branch name run: ./.github/branchNameValidation.sh $STAGE_PREFIX$branch_name - name: set branch specific variable names @@ -102,17 +102,17 @@ jobs: COGNITO_TEST_USERS_PASSWORD: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_COGNITO_TEST_USERS_PASSWORD] || secrets.COGNITO_TEST_USERS_PASSWORD }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - name: Configure AWS credentials for GitHub Actions - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }} aws-region: ${{ env.AWS_DEFAULT_REGION }} - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v3 with: - node-version: "14.x" + node-version: "18.x" - name: Combine package-lock.json files to single file run: find services -maxdepth 3 -name package-lock.json | xargs cat package-lock.json > combined-package-lock.txt - name: cache service dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | services/.sechub/node_modules @@ -177,7 +177,7 @@ jobs: """ exit 1 fi - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Validate branch name run: ./.github/branchNameValidation.sh $STAGE_PREFIX$branch_name - name: set branch specific variable names @@ -198,17 +198,17 @@ jobs: COGNITO_TEST_USERS_PASSWORD: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_COGNITO_TEST_USERS_PASSWORD] || secrets.COGNITO_TEST_USERS_PASSWORD }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - name: Configure AWS credentials for GitHub Actions - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }} aws-region: ${{ env.AWS_DEFAULT_REGION }} - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v3 with: - node-version: "14.x" + node-version: "18.x" - name: Combine package-lock.json files to single file run: find services -maxdepth 3 -name package-lock.json | xargs cat package-lock.json > combined-package-lock.txt - name: cache service dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | services/.sechub/node_modules @@ -337,7 +337,7 @@ jobs: steps: - name: set branch_name run: echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: set branch specific variable names run: ./.github/build_vars.sh set_names - name: set variable values @@ -350,13 +350,13 @@ jobs: COGNITO_TEST_USERS_PASSWORD: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_COGNITO_TEST_USERS_PASSWORD] || secrets.COGNITO_TEST_USERS_PASSWORD }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - name: Configure AWS credentials for GitHub Actions - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }} aws-region: ${{ env.AWS_DEFAULT_REGION }} - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - name: Combine package-lock.json files to single file run: find services -maxdepth 3 -name package-lock.json | xargs cat package-lock.json > combined-package-lock.txt - name: cache service dependencies @@ -392,7 +392,7 @@ jobs: browser: chrome config: baseUrl=${{ env.APPLICATION_ENDPOINT }} - name: Upload screenshots - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: cypress-screenshots @@ -452,13 +452,13 @@ jobs: COGNITO_TEST_USERS_PASSWORD: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_COGNITO_TEST_USERS_PASSWORD] || secrets.COGNITO_TEST_USERS_PASSWORD }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - name: Configure AWS credentials for GitHub Actions - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }} aws-region: ${{ env.AWS_DEFAULT_REGION }} - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - name: Combine package-lock.json files to single file run: find services -maxdepth 3 -name package-lock.json | xargs cat package-lock.json > combined-package-lock.txt - name: cache service dependencies diff --git a/.github/workflows/destroy.yml b/.github/workflows/destroy.yml index 3925a2ba0..beaec7fb0 100644 --- a/.github/workflows/destroy.yml +++ b/.github/workflows/destroy.yml @@ -15,7 +15,7 @@ jobs: steps: - name: set branch_name run: echo "branch_name=${{ github.event.ref }}" >> $GITHUB_ENV - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: set branch specific variable names run: ./.github/build_vars.sh set_names - name: set variable values @@ -25,7 +25,7 @@ jobs: AWS_DEFAULT_REGION: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }} STAGE_PREFIX: ${{ secrets.STAGE_PREFIX }} - name: Configure AWS credentials for GitHub Actions - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }} aws-region: ${{ env.AWS_DEFAULT_REGION }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index cc5bb0da2..5f876c534 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,7 +20,7 @@ jobs: - name: set branch_name run: echo "branch_name=${GITHUB_HEAD_REF}" >> $GITHUB_ENV - name: Configure AWS credentials for GitHub Actions - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }} aws-region: ${{ secrets.AWS_DEFAULT_REGION }} diff --git a/deploy.sh b/deploy.sh index 7b88b87ff..855d87b15 100755 --- a/deploy.sh +++ b/deploy.sh @@ -5,10 +5,10 @@ stage=${1:-dev} install_deps() { if [ "$CI" == "true" ]; then # If we're in a CI system if [ ! -d "node_modules" ]; then # If we don't have any node_modules (CircleCI cache miss scenario), run npm ci. Otherwise, we're all set, do nothing. - npm ci + npm ci --legacy-peer-deps fi else # We're not in a CI system, let's npm install - npm install + npm install --legacy-peer-deps fi } diff --git a/services/app-api/form/submitWaiverExtensionT.test.js b/services/app-api/form/submitWaiverExtensionT.test.js index 90c6c713b..86dce4b0d 100644 --- a/services/app-api/form/submitWaiverExtensionT.test.js +++ b/services/app-api/form/submitWaiverExtensionT.test.js @@ -10,6 +10,7 @@ submitAny.mockResolvedValue("yup!"); const testEvent = { this: "is an event object", + body: "needs to have somebody to love?", }; const expectedResponse = { @@ -21,10 +22,6 @@ const expectedResponse = { statusCode: 200, }; -it("calls submitAny", async () => { - expect(main(testEvent)).resolves.toStrictEqual(expectedResponse); -}); - it("should submit temporary extension 1915b form", async () => { const data = { temporaryExtensionType: "1915(b)", diff --git a/services/app-api/utils/packageExists.test.js b/services/app-api/utils/packageExists.test.js index 4001e5bab..1e38c2fc4 100644 --- a/services/app-api/utils/packageExists.test.js +++ b/services/app-api/utils/packageExists.test.js @@ -4,31 +4,15 @@ import packageExists from "./packageExists"; jest.mock("../libs/dynamodb-lib"); const testID = "a TEST ID"; -describe("ID is checked in every table", () => { - it("checks one table first", () => { +describe("ID is checked in one table", () => { + it("true if the query returns more than 0 items", () => { dynamoDb.query.mockResolvedValueOnce({ Count: 2 }); expect(packageExists(testID)).resolves.toBe(true); }); - it("checks two tables next", () => { - dynamoDb.query - .mockResolvedValueOnce({ Count: 0 }) - .mockResolvedValueOnce({ Count: 2 }); - - expect(packageExists(testID)).resolves.toBe(true); - }); - - dynamoDb.query.mockResolvedValue({ Count: 0 }); - - it("does a scan if the two queries fail", () => { - dynamoDb.scan.mockResolvedValueOnce({ Count: 2 }); - - expect(packageExists(testID)).resolves.toBe(true); - }); - - it("returns false if none of the checks return anything", () => { - dynamoDb.scan.mockResolvedValueOnce({ Count: 0 }); + it("false if the query returns 0 items", () => { + dynamoDb.query.mockResolvedValueOnce({ Count: 0 }); expect(packageExists(testID)).resolves.toBe(false); }); diff --git a/unit-test.sh b/unit-test.sh index 1d7572713..ca912df36 100755 --- a/unit-test.sh +++ b/unit-test.sh @@ -5,7 +5,7 @@ RET=0 for d in services/*/; do pushd $d if [ "`jq '.scripts.test'