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

Testing out the jest testing tool #3

Merged
merged 20 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
82698e3
Refactor: Updated the scheme
joywin2003 Sep 10, 2024
b23b486
Feat: Add registration form schema and type usign zod
joywin2003 Sep 10, 2024
c56e05f
Add API route for submitting a form
joywin2003 Sep 10, 2024
37c6488
Refactor: reanmed the feild names of RegistrationFormSchema
joywin2003 Sep 10, 2024
9a2ba39
Added zod validation for reg form
joywin2003 Sep 10, 2024
92d9dc3
Merge branch 'main' of https://github.com/TEDx-SJEC/website into newform
joywin2003 Sep 10, 2024
4403d47
Fix: added find cmd to find the latest database migration
joywin2003 Sep 10, 2024
6d2e4d9
Refactor: Update form submission route and schema
joywin2003 Sep 10, 2024
6ebcca1
Feat: successfuly make a api requestion but with prisma error
joywin2003 Sep 10, 2024
6075d2d
Merge branch 'main' of https://github.com/TEDx-SJEC/website into newform
joywin2003 Sep 11, 2024
1449d54
Add Node.js CI workflow
joywin2003 Sep 11, 2024
52164a7
Merge branch 'main' of https://github.com/TEDx-SJEC/website into newform
joywin2003 Sep 11, 2024
f4e1d7d
Add Jest configuration for code coverage
joywin2003 Sep 11, 2024
8cd32ba
Add the jest npm package
joywin2003 Sep 11, 2024
7a23fa8
Refactor test workflow to include build step but remove jest
joywin2003 Sep 11, 2024
b20fadd
Refactor: moved the auth options and version to fix build errors - by…
joywin2003 Sep 11, 2024
f931a55
Fix: resolved the db bug due to inconsistent migration
joywin2003 Sep 12, 2024
5ac4ee7
testing with env vairables in workflow
joywin2003 Sep 12, 2024
00a14e8
Refactor: Test 2 with environment variable check
joywin2003 Sep 12, 2024
2b1c5a4
Refactor: Add environment variable checks for Turso authentication an…
joywin2003 Sep 12, 2024
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
62 changes: 62 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Node.js CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Check Environment Variables
run: |
echo "NEXT_PUBLIC_SITE_URL is set: ${{ env.NEXT_PUBLIC_SITE_URL != '' }}"
echo "NEXTAUTH_SECRET is set: ${{ env.NEXTAUTH_SECRET != '' }}"
echo "GOOGLE_ID is set: ${{ env.GOOGLE_ID != '' }}"
echo "GOOGLE_SECRET is set: ${{ env.GOOGLE_SECRET != '' }}"
echo "TURSO_AUTH_TOKEN is set: ${{ env.TURSO_AUTH_TOKEN != '' }}"
echo "TURSO_DATABASE_URL is set: ${{ env.TURSO_DATABASE_URL != '' }}"
env:
NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
GOOGLE_ID: ${{ secrets.GOOGLE_ID }}
GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }}
TURSO_AUTH_TOKEN: ${{ secrets.TURSO_AUTH_TOKEN }}
TURSO_DATABASE_URL: ${{ secrets.TURSO_DATABASE_URL }}

- name: Build project
run: npm run build
env:
GOOGLE_ID: ${{ secrets.GOOGLE_ID }}
GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }}
TURSO_AUTH_TOKEN: ${{ secrets.TURSO_AUTH_TOKEN }}
TURSO_DATABASE_URL: ${{ secrets.TURSO_DATABASE_URL }}

- name: Upload build artifacts (optional)
if: always()
uses: actions/upload-artifact@v3
with:
name: build
path: build # Adjust this if your build output is in a different directory
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov'],
};

Loading
Loading