github.com/hyperledger/aries-framework-go@v0.3.2/pkg/internal/ldtestutil/ldtestutil.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package ldtestutil
     8  
     9  import (
    10  	"testing"
    11  
    12  	"github.com/hyperledger/aries-framework-go/component/models/ld/testutil"
    13  
    14  	ldcontext "github.com/hyperledger/aries-framework-go/component/models/ld/context"
    15  	"github.com/hyperledger/aries-framework-go/component/models/ld/documentloader"
    16  	"github.com/hyperledger/aries-framework-go/component/models/ld/processor"
    17  )
    18  
    19  // WithDocumentLoader returns an option with a custom JSON-LD document loader preloaded with embedded contexts.
    20  func WithDocumentLoader(t *testing.T) processor.Opts {
    21  	return testutil.WithDocumentLoader(t)
    22  }
    23  
    24  // DocumentLoader returns JSON-LD document loader preloaded with embedded contexts and provided extra contexts.
    25  func DocumentLoader(extraContexts ...ldcontext.Document) (*documentloader.DocumentLoader, error) {
    26  	return testutil.DocumentLoader(extraContexts...)
    27  }
    28  
    29  // Contexts returns test JSON-LD contexts.
    30  func Contexts() []ldcontext.Document {
    31  	return testutil.Contexts()
    32  }