mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-18 15:21:04 +00:00
4d91b77d29
Signed-off-by: cassiozareck <cassiomilczareck@gmail.com> (cherry picked from commita878adfe62
) Adding description and Forgejo SVG (cherry picked from commit13738c0380
) Undo reordering and tmpl redirection (cherry picked from commit9ae51c46f4
) (cherry picked from commit70fffdc61d
) (cherry picked from commitc0ebfa9da3
) (cherry picked from commit9922c92787
) (cherry picked from commit00c0effbc7
) (cherry picked from commite4c9525b13
) (cherry picked from commit09d7b83211
) (cherry picked from commitbbcd5975c9
) (cherry picked from commit55c70a0e18
) (cherry picked from commit76596410c0
) (cherry picked from commit1308043931
) (cherry picked from commit919d6aedfe
) [FEAT] add Forgero Git Service (squash) more tests Previously only Gitea service was being tested under self-hosted migrations. Since Forgejo is also self-hosted and in fact use the same downloader/migrator we can add to this suite another test that will do the same, migrating the same repository under the same local instance but for the Forgejo service (represented by 9) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1709 Co-authored-by: zareck <cassiomilczareck@gmail.com> Co-committed-by: zareck <cassiomilczareck@gmail.com> (cherry picked from commit40a4b8f1a8
) (cherry picked from commit3198b4a642
) (cherry picked from commit4edda1f389
)
39 lines
789 B
Go
39 lines
789 B
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package convert
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestToCorrectPageSize(t *testing.T) {
|
|
assert.EqualValues(t, 30, ToCorrectPageSize(0))
|
|
assert.EqualValues(t, 30, ToCorrectPageSize(-10))
|
|
assert.EqualValues(t, 20, ToCorrectPageSize(20))
|
|
assert.EqualValues(t, 50, ToCorrectPageSize(100))
|
|
}
|
|
|
|
func TestToGitServiceType(t *testing.T) {
|
|
tc := []struct {
|
|
typ string
|
|
enum int
|
|
}{{
|
|
typ: "github", enum: 2,
|
|
}, {
|
|
typ: "gitea", enum: 3,
|
|
}, {
|
|
typ: "gitlab", enum: 4,
|
|
}, {
|
|
typ: "gogs", enum: 5,
|
|
}, {
|
|
typ: "forgejo", enum: 9,
|
|
}, {
|
|
typ: "trash", enum: 1,
|
|
}}
|
|
for _, test := range tc {
|
|
assert.EqualValues(t, test.enum, ToGitServiceType(test.typ))
|
|
}
|
|
}
|