summaryrefslogtreecommitdiff
path: root/internal/timestamp/timestamp_test.go
blob: 27d0fd4477a66db108ff34cad81336ba9ff6850f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package timestamp

import (
	"strings"
	"testing"
	"time"
)

func TestUpdateInFilename(t *testing.T) {
	var (
		filePath        = "gosdir/db/platforms/mastodon/1728240487.txt.20241009-232530.queued"
		nowTime         = time.Now()
		updatedFilePath = UpdateInFilename(filePath, -2)
		parts           = strings.Split(updatedFilePath, ".")
	)

	updatedTime, err := Parse(parts[len(parts)-2])
	if err != nil {
		t.Error(err)
	}

	t.Log(filePath, updatedFilePath, nowTime.Sub(updatedTime))
}