Skip to content

Commit

Permalink
Add tests (#71)
Browse files Browse the repository at this point in the history
* restructuring docker builds, removing accessibility plugin since it seems to be failing to build for production

* abstracting base url for the api

* correcting URLs

* added jest to package

* increasing log level

* changed direct file paths to assets to import statements

* added env development to dockerignore

* Removed unneccessary comments

* all tests pass, wicked

* adding readme

* add badges to readme and add matrix for os types

* add matrix to dotnet workflow

* doi badge

* remove extra DOI badge

* readme changes

* undoing port changes

* Changed connection to db for tests

* a single test passes

* Added tests for species controller

* codecov uses cobertura

* Add controller tests

* new default guid

* Moved files to Test file

* moved Properties Controller Tests

* add empty files for future tests

* added get user by email and by id

* added time service

* correcting warnings, correcting filename

* trying to forward requests

* things

* adding production database connection

* default database port

* logging connection string

* copying in the production env file

* removing debug statement

* add tests for backend coverage

* update codecov file

* fix npm build -> npm run build

* fix assertion

* added working directory - codecov

* Add tests for GetMethods

* add lcov format for test

* removed context

* Remove coverage gitignore

* changed file names for codecov compatibility

* moved codecoe.yml

* Fix Default branch

* remove upload from npm_build_test.yml

* removed extra coverage files

---------

Co-authored-by: Kyle Shores <[email protected]>
Co-authored-by: JoshHare <[email protected]>
Co-authored-by: JoshHare <[email protected]>
Co-authored-by: BrittExe <[email protected]>
Co-authored-by: oreogunleye24 <[email protected]>
  • Loading branch information
6 people authored Nov 21, 2024
1 parent 9f44301 commit 9a335f1
Show file tree
Hide file tree
Showing 85 changed files with 37,969 additions and 402 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/codecov.yml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/codecov_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Codecov Coverage

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

jobs:
test:
runs-on: ubuntu-latest

steps:
# Checkout code
- name: Checkout code
uses: actions/checkout@v2

# Setup .NET environment
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18

# Restore dependencies
- name: Install dependencies
run: npm install
working-directory: ./frontend

# Build the project
- name: Build
run: npm run build
working-directory: ./frontend

# Step 5: Run tests and collect code coverage
- name: Test and calculate coverage
run: npm run test:coverage
working-directory: ./frontend


# Step 6: Upload the code coverage report to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # Add the Codecov token in the GitHub secrets
files: ./frontend/coverage/lcov.info # Ensure the correct path for the coverage file
flags: vite-tests
fail_ci_if_error: true
# # Setup .NET environment
# - name: Setup .NET
# uses: actions/setup-dotnet@v3
# with:
# context: ./backend
# dotnet-version: 6.0.x # Use the version your project requires

# # Restore dependencies
# - name: Restore dependencies
# run: dotnet restore ./backend

# # Build the project
# - name: Build
# run: dotnet build ./backend --no-restore

# # Step 5: Run tests and collect code coverage
# - name: Test and calculate coverage
# run: |
# dotnet test ./backend --no-build --verbosity normal --logger "console;verbosity=detailed" \
# /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
# /p:CoverletOutput=./TestResults/coverage.cobertura.xml


# # Step 6: Upload the code coverage report to Codecov
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# context: ./backend
# token: ${{ secrets.CODECOV_TOKEN }} # Add the Codecov token in the GitHub secrets
# files: ./TestResults/coverage.opencover.xml # Ensure the correct path for the coverage file
# flags: unittests
# fail_ci_if_error: true
4 changes: 2 additions & 2 deletions .github/workflows/npm_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ jobs:
# Upload coverage to Codecov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ dist-ssr
*.sw?

node_modules/
/coverage
# /coverage
5 changes: 0 additions & 5 deletions TestResults/coverage.cobertura.xml

This file was deleted.

5 changes: 0 additions & 5 deletions TestResults/coverage.opencover.xml

This file was deleted.

3 changes: 2 additions & 1 deletion backend/ChemistryCafeAPI.Tests/ChemistryCafeAPI.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsTestProject>true</IsTestProject>
Expand Down Expand Up @@ -70,6 +69,8 @@
<PackageReference Include="MySqlConnector.DependencyInjection" Version="2.3.5" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage"
Version="17.10.1" />
</ItemGroup>
<PropertyGroup>
<DebugType>portable</DebugType>
Expand Down
2 changes: 2 additions & 0 deletions backend/ChemistryCafeAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
<PackageReference Include="MySqlConnector.DependencyInjection" Version="2.3.5" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage"
Version="17.10.1" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
codecov:
max_report_age: off
codecov:
branch: AddTests # set new Default branch
2 changes: 1 addition & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ dist-ssr
*.sw?

node_modules/
/coverage
# /coverage
Loading

0 comments on commit 9a335f1

Please sign in to comment.