
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/7337 - Massive replacement of changing `code.gitea.io/gitea` to `forgejo.org`. - Resolves forgejo/discussions#258 Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7354 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
27 lines
819 B
Go
27 lines
819 B
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package migrations
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"forgejo.org/modules/test"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMigrations(t *testing.T) {
|
|
defer test.MockVariableValue(&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))
|
|
}
|