blob: 499d7d5bac17cc3bc24f93753cd860f169f91b46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package timestamp
import (
"strings"
"testing"
)
func TestUpdateInFilename(t *testing.T) {
t.Parallel()
var (
filePath = "gosdir/db/platforms/mastodon/1728240487.txt.20241009-232530.queued"
nowTime = NowTime()
updatedFilePath = UpdateInFilename(filePath, -2)
parts = strings.Split(updatedFilePath, ".")
)
updatedTime, err := Parse(parts[len(parts)-2])
if err != nil {
t.Error(err)
}
if nowTime.Sub(updatedTime) != 0 {
t.Error("expected no time difference here")
}
}
|