summaryrefslogtreecommitdiff
path: root/internal/funcs/data_test.go
blob: b01530b6bef74df419f02cb58f651135f798f83a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package funcs

import (
	"context"
	"strconv"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestCreateDataFuncs(t *testing.T) {
	t.Parallel()

	for i := 0; i < 10; i++ {
		// Run this a bunch to catch race conditions
		t.Run(strconv.Itoa(i), func(t *testing.T) {
			t.Parallel()

			ctx := context.Background()
			fmap := CreateDataFuncs(ctx)
			actual := fmap["data"].(func() interface{})

			assert.Equal(t, ctx, actual().(*DataFuncs).ctx)
		})
	}
}