github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/state/impl_querycontext_storage_test.go (about) 1 /* 2 * Copyright (c) 2023-present unTill Pro, Ltd. 3 */ 4 5 package state 6 7 import ( 8 "context" 9 "testing" 10 11 "github.com/stretchr/testify/require" 12 13 "github.com/voedger/voedger/pkg/appdef" 14 "github.com/voedger/voedger/pkg/istructs" 15 ) 16 17 func TestQueryContextStorage(t *testing.T) { 18 wsid := istructs.NullWSID 19 arg := istructs.NewNullObject() 20 21 wsidFunc := SimpleWSIDFunc(wsid) 22 argFunc := func() istructs.IObject { return arg } 23 24 s := ProvideQueryProcessorStateFactory()(context.Background(), nil, nil, wsidFunc, nil, nil, nil, nil, argFunc, nil, nil, nil) 25 26 kb, err := s.KeyBuilder(QueryContext, appdef.NullQName) 27 require.NoError(t, err) 28 29 v, err := s.MustExist(kb) 30 require.NoError(t, err) 31 require.Equal(t, int64(wsid), v.AsInt64(Field_Workspace)) 32 require.NotNil(t, v.AsValue(Field_ArgumentObject)) 33 }