mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-04-25 01:06:10 +02:00

- Massive replacement of changing `code.gitea.io/gitea` to `forgejo.org`. - Resolves forgejo/discussions#258 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7337 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Reviewed-by: Beowulf <beowulf@beocode.eu> Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package models
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"forgejo.org/models/db"
|
|
issues_model "forgejo.org/models/issues"
|
|
"forgejo.org/models/unittest"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCheckRepoStats(t *testing.T) {
|
|
require.NoError(t, unittest.PrepareTestDatabase())
|
|
require.NoError(t, CheckRepoStats(db.DefaultContext))
|
|
}
|
|
|
|
func TestDoctorUserStarNum(t *testing.T) {
|
|
require.NoError(t, unittest.PrepareTestDatabase())
|
|
|
|
require.NoError(t, DoctorUserStarNum(db.DefaultContext))
|
|
}
|
|
|
|
func Test_repoStatsCorrectIssueNumComments(t *testing.T) {
|
|
require.NoError(t, unittest.PrepareTestDatabase())
|
|
|
|
issue2 := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 2})
|
|
assert.NotNil(t, issue2)
|
|
assert.EqualValues(t, 0, issue2.NumComments) // the fixture data is wrong, but we don't fix it here
|
|
|
|
require.NoError(t, repoStatsCorrectIssueNumComments(db.DefaultContext, 2))
|
|
// reload the issue
|
|
issue2 = unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 2})
|
|
assert.EqualValues(t, 1, issue2.NumComments)
|
|
}
|