storj/satellite/mailservice/simulate/linkclicker_test.go
Jeremy Wharton 51ebc564d9 web/satellite,satellite/console: Overhaul password reset
Updates the password reset page to use the new theme.
Adds new endpoint '/api/v0/auth/reset-password'
for password reset.

Additionally, updates the link-clicking mail simulator to only
click links with a specified attribute. Otherwise, the password reset
cancellation link would be clicked before the password reset link
could be accessed, rendering testing impossible.

Change-Id: I8fde74ef7ad980880a7bf6558e3b9ed31509a393
2021-08-12 17:40:53 +00:00

29 lines
649 B
Go

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package simulate_test
import (
"testing"
"github.com/stretchr/testify/require"
"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>
`
clicker := simulate.LinkClicker{MarkerAttribute: "data-simulate"}
require.ElementsMatch(t, []string{"link1", "link2"}, clicker.FindLinks(data))
clicker.MarkerAttribute = ""
require.ElementsMatch(t, []string{"link1", "link2", "link3"}, clicker.FindLinks(data))
}