Fix CI register persistence bug

This commit is contained in:
Samuel Hawksby-Robinson 2020-10-28 13:41:22 +00:00 committed by Andrea Maria Piana
parent 5426fac0a3
commit 7b77ae9eab
2 changed files with 8 additions and 4 deletions

View File

@ -775,15 +775,15 @@ func (db sqlitePersistence) GetWhenChatIdentityLastPublished(chatId string) (*in
}
defer rows.Close()
var t *int64
var t int64
for rows.Next() {
err = rows.Scan(t)
err = rows.Scan(&t)
if err != nil {
return nil, err
}
}
return t, nil
return &t, nil
}
func (db sqlitePersistence) SaveWhenChatIdentityLastPublished(chatId string) error {

View File

@ -8,6 +8,7 @@ import (
"strconv"
"strings"
"testing"
"time"
"github.com/stretchr/testify/require"
@ -645,7 +646,9 @@ func TestSqlitePersistence_GetWhenChatIdentityLastPublished(t *testing.T) {
db, err := openTestDB()
require.NoError(t, err)
p := sqlitePersistence{db: db}
chatId := "abcd1234"
now := time.Now().Unix()
err = p.SaveWhenChatIdentityLastPublished(chatId)
require.NoError(t, err)
@ -653,7 +656,8 @@ func TestSqlitePersistence_GetWhenChatIdentityLastPublished(t *testing.T) {
ts, err := p.GetWhenChatIdentityLastPublished(chatId)
require.NoError(t, err)
println(&ts)
diff := *ts - now
require.LessOrEqual(t, diff, int64(2))
}
func TestSaveLinks(t *testing.T) {