testutil

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Extensions = []Extension{
	{
		Publisher:   "foo",
		Name:        "zany",
		Description: "foo bar baz qux",
		Tags:        "tag1",
		Categories:  "category1",
		Files: []storage.VSIXAsset{
			{Type: "Microsoft.VisualStudio.Services.Icons.Default", Path: "icon.png", Addressable: "true"},
			{Type: "Unaddressable", Path: "unaddressable.ext", Addressable: "false"},
		},
		Properties: []storage.VSIXProperty{
			{
				ID:    "Microsoft.VisualStudio.Code.ExtensionPack",
				Value: "a.b,b.c",
			},
			{
				ID:    "Microsoft.VisualStudio.Code.ExtensionDependencies",
				Value: "d.e",
			},
		},
		Versions:      []string{"1.0.0", "2.0.0", "3.0.0", "1.5.2", "2.2.2"},
		LatestVersion: "3.0.0",
		Dependencies:  []string{"d.e"},
		Pack:          []string{"a.b", "b.c"},
	},
	{
		Publisher:   "foo",
		Name:        "buz",
		Description: "quix baz bar buz sitting",
		Tags:        "tag2",
		Categories:  "category2",
		Properties: []storage.VSIXProperty{
			{
				ID:    "Microsoft.VisualStudio.Code.ExtensionPack",
				Value: "",
			},
			{
				ID:    "Microsoft.VisualStudio.Code.ExtensionDependencies",
				Value: "",
			},
		},
		Versions:      []string{"version1"},
		LatestVersion: "version1",
	},
	{
		Publisher:     "bar",
		Name:          "squigly",
		Description:   "squigly foo and more foo bar baz",
		Tags:          "tag1,tag2",
		Categories:    "category1,category2",
		Versions:      []string{"version1", "version2"},
		LatestVersion: "version2",
	},
	{
		Publisher:     "fred",
		Name:          "thud",
		Description:   "frobbles the frobnozzle",
		Tags:          "tag3,tag4,tag5",
		Categories:    "category1",
		Versions:      []string{"version1", "version2"},
		LatestVersion: "version2",
	},
	{
		Publisher:     "qqqqqqqqqqq",
		Name:          "qqqqq",
		Description:   "qqqqqqqqqqqqqqqqqqq",
		Tags:          "qq,qqq,qqqq",
		Categories:    "q",
		Versions:      []string{"qqq", "q"},
		LatestVersion: "qqq",
	},
}

Functions

func ConvertExtensionToManifest

func ConvertExtensionToManifest(ext Extension, version string) *storage.VSIXManifest

func ConvertExtensionToManifestBytes added in v1.2.1

func ConvertExtensionToManifestBytes(t *testing.T, ext Extension, version string) []byte

func CreateVSIX added in v1.2.0

func CreateVSIX(t *testing.T, manifestBytes []byte, packageJSONBytes []byte) []byte

createVSIX returns the bytes for a VSIX file containing the provided raw manifest and package.json bytes (if not nil) and an icon.

func CreateVSIXFromExtension added in v1.2.0

func CreateVSIXFromExtension(t *testing.T, ext Extension) []byte

CreateVSIXFromExtension returns the bytes for a VSIX file containing the manifest for the provided test extension and an icon.

func CreateVSIXFromManifest added in v1.2.0

func CreateVSIXFromManifest(t *testing.T, manifest *storage.VSIXManifest) []byte

CreateVSIXFromManifest returns the bytes for a VSIX file containing the provided manifest and an icon.

func CreateVSIXFromPackageJSON added in v1.2.0

func CreateVSIXFromPackageJSON(t *testing.T, packageJSON *storage.VSIXPackageJSON) []byte

Types

type Extension

type Extension struct {
	Publisher     string
	Name          string
	Tags          string
	Files         []storage.VSIXAsset
	Properties    []storage.VSIXProperty
	Description   string
	Categories    string
	Versions      []string
	LatestVersion string
	Dependencies  []string
	Pack          []string
}

type MockDB added in v1.2.0

type MockDB struct {
	// contains filtered or unexported fields
}

MockDB implements database.Database for tests.

func NewMockDB added in v1.2.0

func NewMockDB(exts []*database.Extension) *MockDB

func (*MockDB) GetExtensionAssetPath added in v1.2.0

func (db *MockDB) GetExtensionAssetPath(ctx context.Context, asset *database.Asset, baseURL url.URL) (string, error)

func (*MockDB) GetExtensions added in v1.2.0

func (db *MockDB) GetExtensions(ctx context.Context, filter database.Filter, flags database.Flag, baseURL url.URL) ([]*database.Extension, int, error)

type MockStorage added in v1.2.0

type MockStorage struct{}

MockStorage implements storage.Storage for tests.

func NewMockStorage added in v1.2.0

func NewMockStorage() *MockStorage

func (*MockStorage) AddExtension added in v1.2.0

func (s *MockStorage) AddExtension(ctx context.Context, manifest *storage.VSIXManifest, vsix []byte) (string, error)

func (*MockStorage) FileServer added in v1.2.0

func (s *MockStorage) FileServer() http.Handler

func (*MockStorage) Manifest added in v1.2.0

func (s *MockStorage) Manifest(ctx context.Context, publisher, name, version string) (*storage.VSIXManifest, error)

func (*MockStorage) RemoveExtension added in v1.2.0

func (s *MockStorage) RemoveExtension(ctx context.Context, publisher, name, version string) error

func (*MockStorage) Versions added in v1.2.0

func (s *MockStorage) Versions(ctx context.Context, publisher, name string) ([]string, error)

func (*MockStorage) WalkExtensions added in v1.2.0

func (s *MockStorage) WalkExtensions(ctx context.Context, fn func(manifest *storage.VSIXManifest, versions []string) error) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL