-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Integration tests (#61)
* Setup xUnit * Update README * Rename * Drop boss test * Add new env for tests * Restrict scanned types to solution * Make EF dependency explicit for API * Add working test * Add support to create a theme * Add spec flow tests for create * [WIP] Add test for anonymous * Remove debug statement * Update autogenerated file * Add CI * Add CI config * Wrap and rollback transaction for each spec * Enable CI to read correct configuration * Reduce overrides from tests * Change db name for CI * Extract queries in separate folder * Remove awkward file * Drop Api tests in favor of Specs * Reuse same Test env on CI * Add ability to do matching on responses * Remove debug statements * Disable recording new snapshots on CI * Add CI env back in * Drop mock implementation of repository * Fix build * Drop dummy data migration * Revert "Drop mock implementation of repository" This reverts commit 774d67b. Co-authored-by: Constantin Capatina <[email protected]>
- Loading branch information
Showing
38 changed files
with
819 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ develop, main ] | ||
pull_request: | ||
branches: [ develop, main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
ASPNETCORE_ENVIRONMENT: CI | ||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_DB: teacher_workout_test | ||
POSTGRES_PASSWORD: docker | ||
POSTGRES_USER: docker | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 5.0.x | ||
|
||
- name: Install dependencies | ||
run: dotnet tool install --global dotnet-ef | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore TeacherWorkout.sln | ||
|
||
- name: Build | ||
run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true TeacherWorkout.sln | ||
|
||
- name: Apply migrations | ||
run: dotnet ef database update --no-build --project TeacherWorkout.Domain --startup-project TeacherWorkout.Api | ||
|
||
- name: Run tests | ||
run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover TeacherWorkout.sln |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Untitled GraphQL Schema", | ||
"schemaPath": "schema.graphql", | ||
"extensions": { | ||
"endpoints": { | ||
"Default GraphQL Endpoint": { | ||
"url": "http://localhost:8080/graphql", | ||
"headers": { | ||
"user-agent": "JS GraphQL" | ||
}, | ||
"introspect": false | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
TeacherWorkout.Api/GraphQL/Types/Inputs/ThemeCreateInputType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using GraphQL.Types; | ||
using TeacherWorkout.Domain.Models.Inputs; | ||
|
||
namespace TeacherWorkout.Api.GraphQL.Types.Inputs | ||
{ | ||
public class ThemeCreateInputType : InputObjectGraphType<ThemeCreateInput> | ||
{ | ||
public ThemeCreateInputType() | ||
{ | ||
Name = "ThemeCreateInput"; | ||
|
||
Field(x => x.ThumbnailId, type: typeof(IdGraphType)); | ||
Field(x => x.Title); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
TeacherWorkout.Api/GraphQL/Types/Payloads/ThemeCreatePayloadType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using GraphQL.Types; | ||
using TeacherWorkout.Domain.Models.Payloads; | ||
|
||
namespace TeacherWorkout.Api.GraphQL.Types.Payloads | ||
{ | ||
public class ThemeCreatePayloadType : ObjectGraphType<ThemeCreatePayload> | ||
{ | ||
public ThemeCreatePayloadType() | ||
{ | ||
Name = "ThemeCreatePayload"; | ||
|
||
Field(x => x.Theme).Description("The Theme."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft": "Warning", | ||
"Microsoft.Hosting.Lifetime": "Information" | ||
} | ||
}, | ||
"ConnectionStrings": { | ||
"TeacherWorkoutContext": "host=localhost;Port=5432;Database=teacher_workout_test;User Id=docker;Password=docker;" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft": "Warning", | ||
"Microsoft.Hosting.Lifetime": "Information" | ||
} | ||
}, | ||
"ConnectionStrings": { | ||
"TeacherWorkoutContext": "host=localhost;Port=5432;Database=teacher_workout_test;User Id=docker;Password=docker;" | ||
} | ||
} |
115 changes: 0 additions & 115 deletions
115
TeacherWorkout.Data/Migrations/20210827110928_SeedDummyData.Designer.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.