Add duplicate_requests_test.go

This commit is contained in:
Musab Gültekin 2021-04-16 14:43:42 +03:00
parent be4d13c0ef
commit d8252092f7

View File

@ -0,0 +1,22 @@
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)
}