mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-19 13:39:26 +00:00
Some checks failed
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Integration tests for the release process / release-simulation (push) Has been cancelled
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org> Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
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.Equal(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.Equal(t, 1, issue2.NumComments)
|
|
}
|