Skip to content

Commit

Permalink
fix(tests): minor correction
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshutr committed Oct 9, 2024
1 parent 95f007e commit 0a62c4c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 67 deletions.
3 changes: 2 additions & 1 deletion data/base/number_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package base

import (
"cosmossdk.io/math"
sdkTypes "github.com/cosmos/cosmos-sdk/types"
"reflect"
"testing"
Expand Down Expand Up @@ -81,7 +82,7 @@ func Test_NumberData_GenerateHashID(t *testing.T) {
want ids.HashID
}{
{"+ve", NewNumberData(sdkTypes.NewInt(10)), baseIDs.GenerateHashID([]byte("10")).(*baseIDs.HashID)},
{"+ve", NewNumberData(sdkTypes.NewInt(0)), &baseIDs.HashID{[]byte{}}},
{name: "+ve", args: NewNumberData(sdkTypes.NewInt(0)), want: &baseIDs.HashID{IDBytes: []byte{}}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions documents/base/asset_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package base

import (
"cosmossdk.io/math"
"github.com/AssetMantle/schema/types"
"reflect"
"testing"
Expand Down
1 change: 1 addition & 0 deletions documents/base/classification_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package base

import (
"cosmossdk.io/math"
"github.com/AssetMantle/schema/properties/constants"
sdkTypes "github.com/cosmos/cosmos-sdk/types"
"reflect"
Expand Down
3 changes: 0 additions & 3 deletions documents/base/identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ func Test_identity_GetAuthentication(t *testing.T) {
fromAddress := "cosmos1pkkayn066msg6kn33wnl5srhdt3tnu2vzasz9c"
fromAccAddress, err := sdkTypes.AccAddressFromBech32(fromAddress)
require.Nil(t, err)
type fields struct {
Document documents.Identity
}

tests := []struct {
name string
Expand Down
62 changes: 2 additions & 60 deletions documents/base/maintainer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ func TestNewMaintainer(t *testing.T) {
baseProperties.NewMetaProperty(constantProperties.MaintainedClassificationIDProperty.GetKey(), baseData.NewIDData(classificationID)),
)),
baseQualified.NewMutables(baseLists.NewPropertyList(
baseProperties.NewMetaProperty(constantProperties.MaintainedPropertiesProperty.GetKey(), idListToListData(maintainerProperties)),
baseProperties.NewMetaProperty(constantProperties.PermissionsProperty.GetKey(), idListToListData(permissions)),
baseProperties.NewMetaProperty(constantProperties.MaintainedPropertiesProperty.GetKey(), maintainerProperties.ToListData()),
baseProperties.NewMetaProperty(constantProperties.PermissionsProperty.GetKey(), permissions.ToListData()),
)),
)
type args struct {
Expand All @@ -52,61 +52,3 @@ func TestNewMaintainer(t *testing.T) {
})
}
}

//func Test_identity_GetExpiry(t *testing.T) {
// testImmutables := baseQualified.NewImmutables(baseLists.NewPropertyList(baseProperties.NewMetaProperty(baseIDs.NewStringID("ID1"), baseData.NewStringData("ImmutableData"))))
// testMutables1 := baseQualified.NewMutables(baseLists.NewPropertyList(baseProperties.NewMetaProperty(baseIDs.NewStringID("authentication"), baseData.NewListData().ZeroValue()), baseProperties.NewMetaProperty(baseIDs.NewStringID("expiry"), baseData.NewHeightData(baseTypes.NewHeight(10))), baseProperties.NewMetaProperty(baseIDs.NewStringID("expiryHeight"), baseData.NewHeightData(baseTypes.NewHeight(100)))))
// testMutables2 := baseQualified.NewMutables(baseLists.NewPropertyList(baseProperties.NewMetaProperty(baseIDs.NewStringID("authentication"), baseData.NewListData().ZeroValue()), baseProperties.NewMetaProperty(baseIDs.NewStringID("expiry"), baseData.NewHeightData(baseTypes.NewHeight(10)))))
// classificationID := baseIDs.NewClassificationID(testImmutables, testMutables1)
// testDocument1 := NewDocument(classificationID, testImmutables, testMutables1)
// testIdentity1 := identity{testDocument1}
// testDocument2 := NewDocument(classificationID, testImmutables, testMutables2)
// testIdentity2 := identity{testDocument2}
// type fields struct {
// Document documents.Identity
// }
// tests := []struct {
// name string
// fields fields
// want types.Height
// }{
// {"+ve", fields{testIdentity1}, baseTypes.NewHeight(100)},
// {"+ve", fields{testIdentity2}, baseTypes.NewHeight(-1)},
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// identity := tt.fields.Document
//
// if got := identity.GetExpiry(); !reflect.DeepEqual(got, tt.want) {
// t.Errorf("GetExpiry() = %v, want %v", got, tt.want)
// }
// })
// }
//}
//
//func Test_identity_GetAuthentication(t *testing.T) {
// classificationID, immutables, mutables, _ := createTestInput()
// fromAddress := "cosmos1pkkayn066msg6kn33wnl5srhdt3tnu2vzasz9c"
// fromAccAddress, err := sdkTypes.AccAddressFromBech32(fromAddress)
// require.Nil(t, err)
// type fields struct {
// Document documents.Identity
// }
//
// tests := []struct {
// name string
// fields documents.Identity
// want data.ListData
// }{
// {"+ve", NewIdentityFromDocument(NewDocument(classificationID, immutables, mutables)).ProvisionAddress(fromAccAddress), baseData.NewListData(baseData.NewAccAddressData(fromAccAddress))},
// {"+ve", identity{NewDocument(classificationID, immutables, baseQualified.NewMutables(baseLists.NewPropertyList()))}, constants.AuthenticationProperty.GetData().Get().(data.ListData)},
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
//
// if got := tt.fields.GetAuthentication(); !reflect.DeepEqual(got, tt.want) {
// t.Errorf("GetAuthentication() = %v, want %v", got, tt.want)
// }
// })
// }
//}
7 changes: 4 additions & 3 deletions properties/base/mesa_property_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package base

import (
"cosmossdk.io/math"
dataConstants "github.com/AssetMantle/schema/data/constants"
sdkTypes "github.com/cosmos/cosmos-sdk/types"
"reflect"
Expand Down Expand Up @@ -416,10 +417,10 @@ func Test_MesaPropertyValidateBasic(t *testing.T) {
ID: testPropertyID.(*baseIDs.PropertyID),
DataID: baseData.NewNumberData(sdkTypes.NewInt(10)).GetID().(*baseIDs.DataID),
}, true},
{"-ve", &MesaProperty{
{name: "-ve", args: &MesaProperty{
ID: testPropertyID.(*baseIDs.PropertyID),
DataID: &baseIDs.DataID{&baseIDs.StringID{"S"}, &baseIDs.HashID{[]byte("a")}}},
true},
DataID: &baseIDs.DataID{TypeID: &baseIDs.StringID{IDString: "S"}, HashID: &baseIDs.HashID{IDBytes: []byte("a")}}},
want: true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 0a62c4c

Please sign in to comment.