25 lines
637 B
Go
25 lines
637 B
Go
package workerruntime_test
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"proxy-pool/internal/domain/workerruntime"
|
|
"proxy-pool/internal/domain/workerruntime/contracttest"
|
|
)
|
|
|
|
func TestMemoryStoreContract(t *testing.T) {
|
|
now := time.Date(2026, 7, 31, 9, 0, 0, 0, time.UTC)
|
|
contracttest.Run(t, func(t *testing.T) contracttest.Fixture {
|
|
t.Helper()
|
|
store, err := workerruntime.NewMemoryStore(func() time.Time { return now })
|
|
if err != nil {
|
|
t.Fatalf("NewMemoryStore(): %v", err)
|
|
}
|
|
return contracttest.Fixture{
|
|
Store: store, Reader: store, TTL: time.Minute,
|
|
Advance: func(duration time.Duration) { now = now.Add(duration) },
|
|
}
|
|
})
|
|
}
|