2021-07-23 21:53:19 +01:00
|
|
|
// Copyright (C) 2021 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package simulate_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
2022-05-11 18:23:05 +01:00
|
|
|
"go.uber.org/zap/zaptest"
|
2021-07-23 21:53:19 +01:00
|
|
|
|
|
|
|
"storj.io/storj/satellite/mailservice/simulate"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFindLinks(t *testing.T) {
|
|
|
|
data := `
|
|
|
|
<a href="link1" data-simulate>
|
|
|
|
<A HREF="link2" data-simulate>
|
|
|
|
<a href="link3">
|
|
|
|
<a href>
|
|
|
|
<a data-simulate>
|
|
|
|
`
|
|
|
|
|
2022-05-11 18:23:05 +01:00
|
|
|
clicker := simulate.NewDefaultLinkClicker(zaptest.NewLogger(t))
|
2021-07-23 21:53:19 +01:00
|
|
|
require.ElementsMatch(t, []string{"link1", "link2"}, clicker.FindLinks(data))
|
|
|
|
}
|