Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): init API endpoint testing #82

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/ci-test-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 'Unit tests'
on:
pull_request:

jobs:
unit-test:
runs-on: ubuntu-latest
environment: test

env:
SUPABASE_CACHING_DB_URL: ${{ vars.SUPABASE_CACHING_DB_URL }}
SUPABASE_CACHING_ANON_API_KEY: ${{ secrets.SUPABASE_CACHING_ANON_API_KEY }}
SUPABASE_DATA_DB_URL: ${{ vars.SUPABASE_DATA_DB_URL }}
SUPABASE_DATA_ANON_API_KEY: ${{ secrets.SUPABASE_DATA_ANON_API_KEY }}
WEB3UP_KEY: ${{ secrets.WEB3UP_KEY }}
WEB3UP_PROOF_KEY: ${{ secrets.WEB3UP_PROOF_KEY }}

permissions:
# Required to checkout the code
contents: read
# Required to put a comment into the pull-request
pull-requests: write

steps:
- uses: actions/checkout@v4
- name: 'Install Node'
uses: actions/setup-node@v4
with:
node-version: '20.x'

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Install dependencies
run: pnpm install

- name: 'Run unit tests'
run: npx vitest --coverage.enabled true
- name: 'Report Coverage'
# Set if: always() to also generate the report if tests are failing
# Only works if you set `reportOnFailure: true` in your vite config as specified above
if: always()
uses: davelosert/vitest-coverage-report-action@v2
2 changes: 1 addition & 1 deletion lib/hypercerts-indexer
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
"supabase:types:data": "supabase gen types typescript --local > ./src/types/supabaseData.ts",
"preintegration": "pnpm --dir ./lib/hypercerts-indexer i",
"lint": "eslint",
"test": "vitest"
"test": "vitest",
"test:coverage": "vitest --coverage"
},
"dependencies": {
"@envelop/graphql-middleware": "^6.0.0",
"@graphql-tools/merge": "^9.0.3",
"@graphql-yoga/plugin-response-cache": "^3.5.0",
"@hypercerts-org/marketplace-sdk": "0.2.0",
"@hypercerts-org/marketplace-sdk": "0.2.0",
"@hypercerts-org/sdk": "2.0.0-alpha.11",
"@ipld/car": "^5.2.5",
"@openzeppelin/merkle-tree": "^1.0.5",
Expand Down Expand Up @@ -72,6 +73,7 @@
"@0no-co/graphqlsp": "^1.4.1",
"@eddeee888/gcg-typescript-resolver-files": "^0.7.2",
"@eslint/js": "^9.0.0",
"@faker-js/faker": "^8.4.1",
"@graphql-codegen/cli": "5.0.2",
"@graphql-tools/delegate": "^10.0.3",
"@graphql-tools/executor-http": "^1.0.8",
Expand All @@ -85,6 +87,7 @@
"@types/body-parser": "^1.19.5",
"@types/sinon": "^17.0.2",
"@types/swagger-ui-express": "^4.1.6",
"@vitest/coverage-v8": "^1.6.0",
"chai": "^5.0.0",
"chai-assertions-count": "^1.0.2",
"concurrently": "^8.2.2",
Expand All @@ -100,7 +103,8 @@
"tsx": "^4.7.1",
"typescript": "5.3.3",
"typescript-eslint": "^7.7.0",
"vitest": "^1.1.3"
"vitest": "^1.3.1",
"vitest-mock-extended": "^1.3.1"
},
"packageManager": "pnpm@9.0.6"
}
Loading
Loading