geziyor/middleware/duplicate_requests_test.go
2021-04-16 14:43:42 +03:00

23 lines
674 B
Go

package middleware
import (
"github.com/geziyor/geziyor/client"
"github.com/stretchr/testify/assert"
"strings"
"testing"
)
func TestDuplicateRequests_ProcessRequest(t *testing.T) {
longURL := "https://example.com" + strings.Repeat("/path", 50)
req, err := client.NewRequest("GET", longURL, nil)
assert.NoError(t, err)
req2, err := client.NewRequest("GET", longURL, nil)
assert.NoError(t, err)
duplicateRequestsProcessor := DuplicateRequests{RevisitEnabled: false}
duplicateRequestsProcessor.ProcessRequest(req)
duplicateRequestsProcessor.ProcessRequest(req2)
duplicateRequestsProcessor.ProcessRequest(req2)
duplicateRequestsProcessor.ProcessRequest(req2)
}