mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [x] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. ### Disclaimer Generative AI (ChatGPT) was used to debug the e2e test, with copied code lines below threshold of originality. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11156 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org> Co-authored-by: Robert Wolff <mahlzahn@posteo.de> Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
// Copyright 2026 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package actions
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"forgejo.org/models/unittest"
|
|
"forgejo.org/modules/translation"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestActionStatusList(t *testing.T) {
|
|
require.NoError(t, unittest.PrepareTestDatabase())
|
|
translation.InitLocales(t.Context())
|
|
|
|
statusInfoList := GetStatusInfoList(t.Context(), translation.NewLocale("en-US"))
|
|
assert.Len(t, statusInfoList, 7)
|
|
statuses := []string{"Blocked", "Canceled", "Failure", "Running", "Skipped", "Success", "Waiting"}
|
|
statusInts := []int{7, 3, 2, 6, 4, 1, 5}
|
|
for i, statusString := range statuses {
|
|
assert.Equal(t, statusInfoList[i].Status, statusInts[i])
|
|
assert.Equal(t, statusInfoList[i].DisplayedStatus, statusString)
|
|
}
|
|
|
|
statusInfoList = GetStatusInfoList(t.Context(), translation.NewLocale("de-DE"))
|
|
assert.Len(t, statusInfoList, 7)
|
|
statuses = []string{"Abgebrochen", "Blockiert", "Erfolg", "Fehler", "Laufend", "Übersprungen", "Wartend"}
|
|
statusInts = []int{3, 7, 1, 2, 6, 4, 5}
|
|
for i, statusString := range statuses {
|
|
assert.Equal(t, statusInfoList[i].Status, statusInts[i])
|
|
assert.Equal(t, statusInfoList[i].DisplayedStatus, statusString)
|
|
}
|
|
}
|