Skip to content

Commit

Permalink
added exercises mapper test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
globko committed Oct 23, 2023
1 parent 1e4648b commit da2b626
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions internal/mappers/exercises_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package mappers

import (
"reflect"
"testing"

"github.com/georgylobko/gym-log/internal/database"
)

func TestDatabaseExerciseToExercise(t *testing.T) {
dbExercise := database.GetExircisesRow{
ID: 1,
Name: "Bench press",
PhotoUrl: "http://im.com/benchpress",
MuscleGroups: []string{"Chest"},
}

exercise := ExerciseRow{
ID: dbExercise.ID,
Name: dbExercise.Name,
PhotoUrl: dbExercise.PhotoUrl,
MuscleGroups: dbExercise.MuscleGroups,
}

if !reflect.DeepEqual(DatabaseExerciseRowToExercise(dbExercise), exercise) {
t.Fatalf("db exercise does not equal exercise after mapping")
}
}

0 comments on commit da2b626

Please sign in to comment.