31 lines
683 B
Go
31 lines
683 B
Go
package demoseed
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"reflect"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestProductionMakeupCurriculumMatchesFixture(t *testing.T) {
|
|
data, err := os.ReadFile("../../db/migrations/000006_makeup_course_catalog.up.sql")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
parts := strings.Split(string(data), "$data$")
|
|
if len(parts) != 3 {
|
|
t.Fatal("missing curriculum payload")
|
|
}
|
|
var courses []Course
|
|
if err := json.Unmarshal([]byte(parts[1]), &courses); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !reflect.DeepEqual(courses, Courses) {
|
|
t.Fatal("production starter curriculum differs from makeup fixture")
|
|
}
|
|
if err := validateCurriculum(courses); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|