diff options
author | Joe Chen <jc@unknwon.io> | 2022-06-25 18:07:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-25 18:07:39 +0800 |
commit | 083c3ee659c6c5542687f3bafae68cbc24dbc90f (patch) | |
tree | 0103bf3b5c5ebfccd368a7cb6a425a521fd669d9 /internal/db/watches_test.go | |
parent | 9df4e3ae3c555a86f691f0d78a43834842e77d8b (diff) |
db: refactor "action" table to use GORM (#7054)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/db/watches_test.go')
-rw-r--r-- | internal/db/watches_test.go | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/internal/db/watches_test.go b/internal/db/watches_test.go new file mode 100644 index 00000000..7ec5b93c --- /dev/null +++ b/internal/db/watches_test.go @@ -0,0 +1,47 @@ +// Copyright 2022 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package db + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "gogs.io/gogs/internal/dbtest" +) + +func TestWatches(t *testing.T) { + if testing.Short() { + t.Skip() + } + t.Parallel() + + tables := []interface{}{new(Watch)} + db := &watches{ + DB: dbtest.NewDB(t, "watches", tables...), + } + + for _, tc := range []struct { + name string + test func(*testing.T, *watches) + }{ + {"ListByRepo", watchesListByRepo}, + } { + t.Run(tc.name, func(t *testing.T) { + t.Cleanup(func() { + err := clearTables(t, db.DB, tables...) + require.NoError(t, err) + }) + tc.test(t, db) + }) + if t.Failed() { + break + } + } +} + +func watchesListByRepo(_ *testing.T, _ *watches) { + // TODO: Add tests once WatchRepo is migrated to GORM. +} |