1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-09-15 11:06:23 -07:00
gochan/cmd/gochan-migration/internal/pre2021/staff_test.go

33 lines
720 B
Go

package pre2021
import (
"testing"
"github.com/gochan-org/gochan/pkg/gcsql"
"github.com/stretchr/testify/assert"
)
func TestMigrateStaff(t *testing.T) {
outDir := t.TempDir()
migrator := setupMigrationTest(t, outDir, false)
if !assert.False(t, migrator.IsMigratingInPlace(), "This test should not be migrating in place") {
t.FailNow()
}
if !assert.NoError(t, migrator.MigrateBoards()) {
t.FailNow()
}
if !assert.NoError(t, migrator.MigrateStaff()) {
t.FailNow()
}
validateStaffMigration(t)
}
func validateStaffMigration(t *testing.T) {
migratedAdmin, err := gcsql.GetStaffByUsername("migratedadmin", true)
if !assert.NoError(t, err) {
t.FailNow()
}
assert.Equal(t, 3, migratedAdmin.Rank)
}