Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Nov 8, 2023
1 parent a70bbbb commit dd17f66
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 79 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
cosmossdk.io/math v1.0.1
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.8.0
github.com/cosmos/cosmos-proto v1.0.0-beta.2
github.com/cosmos/cosmos-sdk v0.47.3
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-go/v7 v7.1.0
Expand All @@ -29,7 +28,6 @@ require (
go.uber.org/multierr v1.11.0
golang.org/x/crypto v0.12.0
golang.org/x/sync v0.3.0
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
google.golang.org/grpc v1.56.1
gopkg.in/yaml.v2 v2.4.0
)
Expand Down Expand Up @@ -73,6 +71,7 @@ require (
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v0.20.0 // indirect
Expand Down Expand Up @@ -268,6 +267,7 @@ require (
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/api v0.122.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions proto/pocket/shared/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ message Service {

// ApplicationServiceConfig holds the service configuration the application stakes for
message ApplicationServiceConfig {
Service service = 1; // The Service for which the application is configured for
Service service = 1; // The Service for which the application is configured

// TODO_RESEARCH: There is an opportunity for applications to advertise the max
// they're willing to pay for a certain configuration/price, but this is outside of scope.
Expand All @@ -28,7 +28,7 @@ message ApplicationServiceConfig {

// SupplierServiceConfig holds the service configuration the supplier stakes for
message SupplierServiceConfig {
Service service = 1; // The Service for which the supplier is configured for
Service service = 1; // The Service for which the supplier is configured
repeated SupplierEndpoint endpoints = 2; // List of endpoints for the service
// TODO_RESEARCH: There is an opportunity for supplier to advertise the min
// they're willing to earn for a certain configuration/price, but this is outside of scope.
Expand Down
75 changes: 0 additions & 75 deletions x/shared/helpers/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,77 +79,6 @@ func TestIsValidService(t *testing.T) {
}
}

func TestIsValidServiceId(t *testing.T) {
tests := []struct {
desc string

input string
expected bool
}{
{
desc: "Valid alphanumeric with hyphen",

input: "Hello-1",
expected: true,
},
{
desc: "Valid alphanumeric with underscore",

input: "Hello_2",
expected: true,
},
{
desc: "Exceeds maximum length",

input: "hello-world",
expected: false, // exceeds maxServiceIdLength
},
{
desc: "Contains invalid character '@'",

input: "Hello@",
expected: false, // contains invalid character '@'
},
{
desc: "All uppercase",

input: "HELLO",
expected: true,
},
{
desc: "Maximum length boundary",

input: "12345678",
expected: true, // exactly maxServiceIdLength
},
{
desc: "Above maximum length boundary",

input: "123456789",
expected: false, // exceeds maxServiceIdLength
},
{
desc: "Contains invalid character '.'",

input: "Hello.World",
expected: false, // contains invalid character '.'
},
{
desc: "Empty string",

input: "",
expected: false, // empty string
},
}

for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
result := IsValidServiceId(test.input)
require.Equal(t, test.expected, result)
})
}
}

func TestIsValidServiceName(t *testing.T) {
tests := []struct {
desc string
Expand Down Expand Up @@ -196,10 +125,6 @@ func TestIsValidServiceName(t *testing.T) {
for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
result := IsValidServiceName(test.input)
if result != test.expected {
t.Errorf("%s: For input '%s', expected %v but got %v", test.desc, test.input, test.expected, result)
}
result := IsValidService(service)
require.Equal(t, test.expected, result)
})
}
Expand Down

0 comments on commit dd17f66

Please sign in to comment.