testcases

package
v0.0.0-...-3218bef Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityValidName      = "this is a name"
	EntityTooLongName    = "this is a name but it is soooooooooooooooooooo long"
	EntityValidURL       = "https://hello.world/bar/goo"
	EntityTooLongURL     = "https://too.too.too.too.too.too.too.too.too.too.too.too.too.too.long"
	EntityValidEmail     = "hello@world.org"
	EntityTooLongEmail   = "too@too.too.too.too.too.too.too.long"
	EntityValidKeybase   = "Hello_world42"
	EntityTooLongKeybase = "tootootootootootootootootootoolong"
	EntityValidTwitter   = "Hello_world42"
	EntityTooLongTwitter = "tootootootootootootootootootoolong"
)

Variables

View Source
var (

	// EntityMetadataBasicVersionAndSize are the entity metadata test cases that
	// contain test cases for basic version and field sizes checks.
	EntityMetadataBasicVersionAndSize []EntityMetadataTestCase = []EntityMetadataTestCase{
		{"InvalidVersion1", registry.EntityMetadata{Versioned: v0}, false},
		{"InvalidVersion2", registry.EntityMetadata{Versioned: v2}, false},
		{"ValidName", registry.EntityMetadata{Versioned: v1, Name: EntityValidName}, true},
		{"TooLongName", registry.EntityMetadata{Versioned: v1, Name: EntityTooLongName}, false},
		{"ValidURL", registry.EntityMetadata{Versioned: v1, URL: EntityValidURL}, true},
		{"TooLongURL", registry.EntityMetadata{Versioned: v1, URL: EntityTooLongURL}, false},
		{"ValidEmail", registry.EntityMetadata{Versioned: v1, Email: EntityValidEmail}, true},
		{"TooLongEmail", registry.EntityMetadata{Versioned: v1, Email: EntityTooLongEmail}, false},
		{"ValidKeybase", registry.EntityMetadata{Versioned: v1, Keybase: EntityValidKeybase}, true},
		{"TooLongKeybase", registry.EntityMetadata{Versioned: v1, Keybase: EntityTooLongKeybase}, false},
		{"ValidTwitter", registry.EntityMetadata{Versioned: v1, Twitter: EntityValidTwitter}, true},
		{"TooLongTwitter", registry.EntityMetadata{Versioned: v1, Twitter: EntityTooLongTwitter}, false},
	}

	// EntityMetadataExtendedVersionAndSize are the entity metadata test cases
	// that contain test cases for extended version and field sizes checks.
	// NOTE: All these test cases contain full entity metadata structs (i.e. no
	// fields are empty).
	EntityMetadataExtendedVersionAndSize []EntityMetadataTestCase

	// EntityMetadataFieldSemantics are the entity metadata test cases that
	// contain test cases for checking fields' semantics.
	EntityMetadataFieldSemantics []EntityMetadataTestCase = []EntityMetadataTestCase{
		{"ValidURL", registry.EntityMetadata{Versioned: v1, URL: EntityValidURL}, true},
		{"BadSchemeURL", registry.EntityMetadata{Versioned: v1, URL: "http://hello.world/bar/goo"}, false},
		{"BadQueryURL", registry.EntityMetadata{Versioned: v1, URL: "https://hello.world/bar?goo=1"}, false},
		{"BadFragmentURL", registry.EntityMetadata{Versioned: v1, URL: "https://hello.world/bar#goo"}, false},
		{"BadPortURL", registry.EntityMetadata{Versioned: v1, URL: "https://hello.world:123/bar"}, false},
		{"BadURL1", registry.EntityMetadata{Versioned: v1, URL: "hello.world"}, false},
		{"BadURL2", registry.EntityMetadata{Versioned: v1, URL: "127.0.0.1:1234"}, false},
		{"ValidEmail", registry.EntityMetadata{Versioned: v1, Email: EntityValidEmail}, true},
		{"BadEmail1", registry.EntityMetadata{Versioned: v1, Email: "hello world.org"}, false},
		{"BadEmail2", registry.EntityMetadata{Versioned: v1, Email: "Hello World <hello@world.org>"}, false},
		{"BadEmail3", registry.EntityMetadata{Versioned: v1, Email: "@world.org"}, false},
		{"BadEmail4", registry.EntityMetadata{Versioned: v1, Email: "hello@.org"}, false},
		{"ValidKeybase", registry.EntityMetadata{Versioned: v1, Keybase: EntityValidKeybase}, true},
		{"BadKeybase1", registry.EntityMetadata{Versioned: v1, Keybase: "helloworld-"}, false},
		{"BadKeybase2", registry.EntityMetadata{Versioned: v1, Keybase: "https://keybase.io/hello"}, false},
		{"BadKeybase3", registry.EntityMetadata{Versioned: v1, Keybase: "foo-bar"}, false},
		{"BadKeybase4", registry.EntityMetadata{Versioned: v1, Keybase: "foo:bar"}, false},
		{"ValidTwitter", registry.EntityMetadata{Versioned: v1, Twitter: EntityValidTwitter}, true},
		{"BadTwitter1", registry.EntityMetadata{Versioned: v1, Twitter: "helloworld-"}, false},
		{"BadTwitter2", registry.EntityMetadata{Versioned: v1, Twitter: "https://twitter.com/hello"}, false},
		{"BadTwitter3", registry.EntityMetadata{Versioned: v1, Twitter: "foo-bar"}, false},
		{"BadTwitter4", registry.EntityMetadata{Versioned: v1, Twitter: "foo:bar"}, false},
	}
)

Functions

This section is empty.

Types

type EntityMetadataTestCase

type EntityMetadataTestCase struct {
	Name       string
	EntityMeta registry.EntityMetadata
	Valid      bool
}

EntityMetadataTestCase is an entity metadata test case.

Jump to

Keyboard shortcuts

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