
**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>
33 lines
823 B
Go
33 lines
823 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package actions
|
|
|
|
import (
|
|
"testing"
|
|
|
|
actions_model "forgejo.org/models/actions"
|
|
"forgejo.org/models/db"
|
|
unittest "forgejo.org/models/unittest"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func Test_loadIsRefDeleted(t *testing.T) {
|
|
unittest.PrepareTestEnv(t)
|
|
|
|
runs, total, err := db.FindAndCount[actions_model.ActionRun](db.DefaultContext,
|
|
actions_model.FindRunOptions{RepoID: 4, Ref: "refs/heads/test"})
|
|
require.NoError(t, err)
|
|
assert.Len(t, runs, 1)
|
|
assert.EqualValues(t, 1, total)
|
|
for _, run := range runs {
|
|
assert.False(t, run.IsRefDeleted)
|
|
}
|
|
|
|
require.NoError(t, loadIsRefDeleted(db.DefaultContext, 4, runs))
|
|
for _, run := range runs {
|
|
assert.True(t, run.IsRefDeleted)
|
|
}
|
|
}
|