mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
848 B
28 lines
848 B
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package migrations
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"code.gitea.io/gitea/modules/test"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMigrations(t *testing.T) {
|
|
defer test.MockVariableValue(&preparedMigrations)()
|
|
preparedMigrations = []*migration{
|
|
{idNumber: 70},
|
|
{idNumber: 71},
|
|
}
|
|
assert.EqualValues(t, 72, calcDBVersion(preparedMigrations))
|
|
assert.EqualValues(t, 72, ExpectedDBVersion())
|
|
|
|
assert.EqualValues(t, 71, migrationIDNumberToDBVersion(70))
|
|
|
|
assert.EqualValues(t, []*migration{{idNumber: 70}, {idNumber: 71}}, getPendingMigrations(70, preparedMigrations))
|
|
assert.EqualValues(t, []*migration{{idNumber: 71}}, getPendingMigrations(71, preparedMigrations))
|
|
assert.EqualValues(t, []*migration{}, getPendingMigrations(72, preparedMigrations))
|
|
}
|
|
|