Skip to content

test: add not found feed test in feeds api integration test #7

test: add not found feed test in feeds api integration test

test: add not found feed test in feeds api integration test #7

Workflow file for this run

name: Unit Tests
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Create ./env/.env.test file
run: |
mkdir -p ./env
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> ./env/.env.test
- name: Install dependencies
run: npm install
- name: Build the project
run: npm run build
- name: Run unit tests
run: npm run test:unit-coverage
# The following Steps has been modified based on the following Github-Action.
# https://github.com/marketplace/actions/coverage-badge
- name: Get Values
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
id: get-values
shell: bash
run: |
COV=$(node -p 't=require(`./coverage/coverage-summary.json`).total,Math.min(...`lines|statements|functions|branches`.split(`|`).map(k=>t[k].pct))')
echo "coverage=$COV" >> $GITHUB_OUTPUT
- name: Checkout gh-pages
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Create Badges
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
shell: bash
run: |
npm i -g badgen-cli
export COV=${{ steps.get-values.outputs.coverage }}
COLOR=$(node -p '+process.env.COV >= 90 ? `green` : +process.env.COV >= 60 ? `orange` : `red`')
mkdir -p badges
badgen -j "Unit Coverage" -s $COV% -c $COLOR > badges/unitcoverage.svg
- name: Deploy Badges
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update badges [skip ci]"
branch: gh-pages
skip_fetch: true
skip_checkout: true
- name: Checkout Back
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}