github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/pkg/shortcut/shortcut_test.go (about)

     1  package shortcut
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestShortcut(t *testing.T) {
    11  	link := "https://alice-drive.cozy.example/"
    12  	buf := Generate(link)
    13  	res, err := Parse(bytes.NewReader(buf))
    14  	assert.NoError(t, err)
    15  	assert.Equal(t, link, res.URL)
    16  }
    17  
    18  func TestShortcutUnixFileFormat(t *testing.T) {
    19  	link := "https://alice-drive.cozy.example/"
    20  	buf := Generate(link)
    21  	buf = bytes.ReplaceAll(buf, []byte{'\r'}, []byte{})
    22  	res, err := Parse(bytes.NewReader(buf))
    23  	assert.NoError(t, err)
    24  	assert.Equal(t, link, res.URL)
    25  }