testutils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testutils contains code that is useful in tests.

Index

Constants

View Source
const (
	AllChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
)

Variables

View Source
var (
	TupleKeyCmpTransformer = cmp.Transformer("Sort", func(in []*openfgav1.TupleKey) []*openfgav1.TupleKey {
		out := append([]*openfgav1.TupleKey(nil), in...)

		sort.SliceStable(out, func(i, j int) bool {
			if out[i].Object > out[j].Object {
				return false
			}

			if out[i].Relation > out[j].Relation {
				return false
			}

			if out[i].User > out[j].User {
				return false
			}

			return true
		})

		return out
	})
)

Functions

func CreateRandomString

func CreateRandomString(n int) string

func MakeSliceWithGenerator added in v1.3.8

func MakeSliceWithGenerator[T any](n uint64, generator func(n uint64) any) []T

MakeSliceWithGenerator generates a slice of length 'n' and populates the contents with values based on the generator provided.

func MakeStringWithRuneset added in v1.3.8

func MakeStringWithRuneset(n uint64, runeSet []rune) string

func MustNewStruct added in v1.3.8

func MustNewStruct(t *testing.T, v map[string]interface{}) *structpb.Struct

func NumericalStringGenerator added in v1.3.8

func NumericalStringGenerator(n uint64) any

NumericalStringGenerator generates a string representation of the provided uint value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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