@@ -13,7 +13,7 @@ import (
1313
1414 "github.com/gopherd/core/component"
1515 "github.com/gopherd/core/op"
16- "github.com/gopherd/core/types "
16+ "github.com/gopherd/core/typing "
1717)
1818
1919func TestMain (m * testing.M ) {
@@ -139,11 +139,11 @@ func TestConfigMarshalUnmarshal(t *testing.T) {
139139 config : component.Config {
140140 Name : "TestComponent" ,
141141 UUID : "test-uuid" ,
142- Refs : types .NewRawObject (`{"ref1":"uuid1"}` ),
143- Options : types .NewRawObject (`{"option1":"value1"}` ),
144- TemplateUUID : op .Addr (types .Bool (true )),
145- TemplateRefs : op .Addr (types .Bool (false )),
146- TemplateOptions : op .Addr (types .Bool (true )),
142+ Refs : typing .NewRawObject (`{"ref1":"uuid1"}` ),
143+ Options : typing .NewRawObject (`{"option1":"value1"}` ),
144+ TemplateUUID : op .Addr (typing .Bool (true )),
145+ TemplateRefs : op .Addr (typing .Bool (false )),
146+ TemplateOptions : op .Addr (typing .Bool (true )),
147147 },
148148 want : `{"Name":"TestComponent","UUID":"test-uuid","Refs":{"ref1":"uuid1"},"Options":{"option1":"value1"},"TemplateUUID":true,"TemplateRefs":false,"TemplateOptions":true}` ,
149149 },
@@ -192,7 +192,7 @@ func TestBaseComponentSetup(t *testing.T) {
192192 config : component.Config {
193193 Name : "TestComponent" ,
194194 UUID : "test-uuid" ,
195- Options : types .NewRawObject (`{"Value":"test"}` ),
195+ Options : typing .NewRawObject (`{"Value":"test"}` ),
196196 },
197197 wantErr : false ,
198198 },
@@ -201,7 +201,7 @@ func TestBaseComponentSetup(t *testing.T) {
201201 config : component.Config {
202202 Name : "TestComponent" ,
203203 UUID : "test-uuid" ,
204- Options : types .NewRawObject (`{"InvalidKey":"test"}` ),
204+ Options : typing .NewRawObject (`{"InvalidKey":"test"}` ),
205205 },
206206 wantErr : false ,
207207 },
@@ -210,7 +210,7 @@ func TestBaseComponentSetup(t *testing.T) {
210210 config : component.Config {
211211 Name : "TestComponent" ,
212212 UUID : "test-uuid" ,
213- Options : types .NewRawObject (`{invalid json` ),
213+ Options : typing .NewRawObject (`{invalid json` ),
214214 },
215215 wantErr : true ,
216216 },
@@ -534,17 +534,17 @@ func TestRegisterAndCreate(t *testing.T) {
534534func TestBoolPointerBehavior (t * testing.T ) {
535535 tests := []struct {
536536 name string
537- boolPtr * types .Bool
537+ boolPtr * typing .Bool
538538 wantJSON string
539539 }{
540540 {
541541 name : "True value" ,
542- boolPtr : op .Addr (types .Bool (true )),
542+ boolPtr : op .Addr (typing .Bool (true )),
543543 wantJSON : "true" ,
544544 },
545545 {
546546 name : "False value" ,
547- boolPtr : op .Addr (types .Bool (false )),
547+ boolPtr : op .Addr (typing .Bool (false )),
548548 wantJSON : "false" ,
549549 },
550550 {
@@ -565,7 +565,7 @@ func TestBoolPointerBehavior(t *testing.T) {
565565 t .Errorf ("Marshaled JSON does not match expected.\n Got: %s\n Want: %s" , string (data ), tt .wantJSON )
566566 }
567567
568- var unmarshaled * types .Bool
568+ var unmarshaled * typing .Bool
569569 err = json .Unmarshal (data , & unmarshaled )
570570 if err != nil {
571571 t .Fatalf ("Failed to unmarshal bool pointer: %v" , err )
@@ -596,7 +596,7 @@ func ExampleBaseComponent() {
596596 config := component.Config {
597597 Name : "ExampleComponent" ,
598598 UUID : "example-uuid" ,
599- Options : types .NewRawObject (`{"Value":"example"}` ),
599+ Options : typing .NewRawObject (`{"Value":"example"}` ),
600600 }
601601
602602 err := mc .Setup (container , & config , false )
@@ -665,7 +665,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
665665 config := component.Config {
666666 Name : "TestComponentWithRefs" ,
667667 UUID : "test-uuid" ,
668- Refs : types .NewRawObject (`{"Ref1":"ref1","Ref2":"ref2"}` ),
668+ Refs : typing .NewRawObject (`{"Ref1":"ref1","Ref2":"ref2"}` ),
669669 }
670670
671671 err := tc .Setup (container , & config , false )
@@ -686,7 +686,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
686686 config := component.Config {
687687 Name : "TestComponentWithRefs" ,
688688 UUID : "test-uuid" ,
689- Refs : types .NewRawObject (`{invalid json` ),
689+ Refs : typing .NewRawObject (`{invalid json` ),
690690 }
691691 err := tc .Setup (container , & config , false )
692692 if err == nil || ! strings .Contains (err .Error (), "failed to unmarshal refs" ) {
@@ -702,7 +702,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
702702 config := component.Config {
703703 Name : "TestComponentWithRefs" ,
704704 UUID : "test-uuid" ,
705- Refs : types .NewRawObject (`{"Ref1":"non-existent-uuid"}` ),
705+ Refs : typing .NewRawObject (`{"Ref1":"non-existent-uuid"}` ),
706706 }
707707 err := tc .Setup (mockContainer , & config , false )
708708 if err == nil || ! strings .Contains (err .Error (), "failed to resolve reference" ) {
@@ -730,7 +730,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
730730 config := component.Config {
731731 Name : "NestedComponent" ,
732732 UUID : "nested-uuid" ,
733- Refs : types .NewRawObject (`{"Ref1":"ref1","NestedStruct":{"Ref2":"ref2"}}` ),
733+ Refs : typing .NewRawObject (`{"Ref1":"ref1","NestedStruct":{"Ref2":"ref2"}}` ),
734734 }
735735
736736 err := nc .Setup (container , & config , false )
@@ -775,7 +775,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
775775 config := component.Config {
776776 Name : "MixedComponent" ,
777777 UUID : "mixed-uuid" ,
778- Refs : types .NewRawObject (`{"Ref1":"ref1","Ref2":null,"Ref3":{},"Ref4":"not-a-ref","X":{"Ref5":"ref1"},"Y":{"Ref6":"ref1"},"Ref7":["ref1","ref1"],"Ref8":["ref1"],"Ref9":{"key":"ref1"}}` ),
778+ Refs : typing .NewRawObject (`{"Ref1":"ref1","Ref2":null,"Ref3":{},"Ref4":"not-a-ref","X":{"Ref5":"ref1"},"Y":{"Ref6":"ref1"},"Ref7":["ref1","ref1"],"Ref8":["ref1"],"Ref9":{"key":"ref1"}}` ),
779779 }
780780
781781 err := mixedComp .Setup (container , & config , false )
@@ -833,7 +833,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
833833 config := component.Config {
834834 Name : "TestComponentWithRefs" ,
835835 UUID : "test-uuid" ,
836- Refs : types .NewRawObject (`{invalid json` ),
836+ Refs : typing .NewRawObject (`{invalid json` ),
837837 }
838838 err := tc .Setup (newMockContainer (), & config , false )
839839 if err == nil || ! strings .Contains (err .Error (), "failed to unmarshal refs" ) {
@@ -846,7 +846,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
846846 config := component.Config {
847847 Name : "NonStructRefs" ,
848848 UUID : "non-struct-uuid" ,
849- Refs : types .NewRawObject (`"string ref"` ),
849+ Refs : typing .NewRawObject (`"string ref"` ),
850850 }
851851 err := cnsr .Setup (newMockContainer (), & config , false )
852852 if err != nil {
@@ -867,7 +867,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
867867 config := component.Config {
868868 Name : "DeepRefs" ,
869869 UUID : "deep-refs-uuid" ,
870- Refs : types .NewRawObject (`{
870+ Refs : typing .NewRawObject (`{
871871 "Ref1": "ref1",
872872 "Nested": {
873873 "Ref2": "ref2",
@@ -905,7 +905,7 @@ func TestBaseComponentWithRefs(t *testing.T) {
905905 config := component.Config {
906906 Name : "FailingResolver" ,
907907 UUID : "failing-resolver-uuid" ,
908- Refs : types .NewRawObject (`{"FailingRef": "some-uuid"}` ),
908+ Refs : typing .NewRawObject (`{"FailingRef": "some-uuid"}` ),
909909 }
910910
911911 err := cfr .Setup (newMockContainer (), & config , false )
0 commit comments