mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-01-11 20:56:29 +00:00
Thanks a lot to @floss4good who pointed this out in the comments of #10253! Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10275 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: floss4good <floss4good@noreply.codeberg.org> Co-authored-by: nachtjasmin <nachtjasmin@posteo.de> Co-committed-by: nachtjasmin <nachtjasmin@posteo.de>
33 lines
814 B
Go
33 lines
814 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"
|
|
"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)
|
|
}
|
|
}
|