flamingo.me/flamingo-commerce/v3@v3.11.0/breadcrumbs/breadcrumbs_test.go (about)

     1  package breadcrumbs
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"flamingo.me/flamingo/v3/framework/web"
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestAdd(t *testing.T) {
    12  	crumb := Crumb{
    13  		Title: "Test",
    14  		URL:   "http://testurl/",
    15  	}
    16  
    17  	r := web.CreateRequest(nil, nil)
    18  	ctx := web.ContextWithRequest(context.Background(), r)
    19  
    20  	Add(ctx, crumb)
    21  	Add(ctx, crumb)
    22  
    23  	b, _ := r.Values.Load(requestKey)
    24  	assert.Len(t, b, 2)
    25  }