mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 22:55:27 +00:00
* chore: fix non-constant fmt string in call Signed-off-by: Dwi Siswanto <git@dw1.io> * build: bump all direct modules Signed-off-by: Dwi Siswanto <git@dw1.io> * chore(hosterrorscache): update import path Signed-off-by: Dwi Siswanto <git@dw1.io> * fix(charts): break changes Signed-off-by: Dwi Siswanto <git@dw1.io> * build: pinned `github.com/zmap/zcrypto` to v0.0.0-20240512203510-0fef58d9a9db Signed-off-by: Dwi Siswanto <git@dw1.io> * chore: golangci-lint auto fixes Signed-off-by: Dwi Siswanto <git@dw1.io> * chore: satisfy lints Signed-off-by: Dwi Siswanto <git@dw1.io> * build: migrate `github.com/xanzy/go-gitlab` => `gitlab.com/gitlab-org/api/client-go` Signed-off-by: Dwi Siswanto <git@dw1.io> * feat(json): update build constraints Signed-off-by: Dwi Siswanto <git@dw1.io> * chore: dont panicking on close err Signed-off-by: Dwi Siswanto <git@dw1.io> --------- Signed-off-by: Dwi Siswanto <git@dw1.io>
34 lines
847 B
Go
34 lines
847 B
Go
package dedupe
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/output"
|
|
)
|
|
|
|
func TestDedupeDuplicates(t *testing.T) {
|
|
tempDir, err := os.MkdirTemp("", "nuclei")
|
|
require.Nil(t, err, "could not create temporary storage")
|
|
defer func() {
|
|
_ = os.RemoveAll(tempDir)
|
|
}()
|
|
|
|
storage, err := New(tempDir)
|
|
require.Nil(t, err, "could not create duplicate storage")
|
|
|
|
tests := []*output.ResultEvent{
|
|
{TemplateID: "test", Host: "https://example.com"},
|
|
{TemplateID: "test", Host: "https://example.com"},
|
|
}
|
|
first, err := storage.Index(tests[0])
|
|
require.Nil(t, err, "could not index item")
|
|
require.True(t, first, "could not index valid item")
|
|
|
|
second, err := storage.Index(tests[1])
|
|
require.Nil(t, err, "could not index item")
|
|
require.False(t, second, "could index duplicate item")
|
|
}
|