You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
720 B
42 lines
720 B
2 months ago
|
package service
|
||
|
|
||
|
import (
|
||
|
"github.com/go-redis/redis/v8"
|
||
|
"log"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestQueryFavoriteCount(t *testing.T) {
|
||
|
Init()
|
||
|
|
||
|
video_id := int64(2222222222222222222)
|
||
|
list := []int64{video_id}
|
||
|
|
||
|
res, err := QueryFavoriteCount(list)
|
||
|
if err != nil && err != redis.Nil {
|
||
|
log.Panicln(err)
|
||
|
}
|
||
|
|
||
|
log.Println(res)
|
||
|
}
|
||
|
|
||
|
func TestReadCountFromCache(t *testing.T) {
|
||
|
Init()
|
||
|
video_id := int64(1111111111111111111)
|
||
|
num, ok, err := ReadCountFromCache(video_id)
|
||
|
if err != nil {
|
||
|
log.Panicln(err)
|
||
|
}
|
||
|
log.Println(num, ok)
|
||
|
}
|
||
|
|
||
|
func TestReadFavTotalCount(t *testing.T) {
|
||
|
Init()
|
||
|
video_id := int64(1111111111111111111)
|
||
|
num, ok, err := ReadFavTotalCount(video_id)
|
||
|
if err != nil {
|
||
|
log.Panicln(err)
|
||
|
}
|
||
|
log.Println(num, ok)
|
||
|
}
|