mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 14:06:15 +01:00
0a55a2f382
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
)
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))
|
|
}
|
|
}
|