fixed spelling error

This commit is contained in:
Iraq Jaber
2025-06-13 17:53:47 +02:00
parent d150348e02
commit b1f25a50d9
2 changed files with 6 additions and 6 deletions

View File

@@ -83,16 +83,16 @@ func (i *instance) Create(ctx context.Context, instance *domain.Instance) error
// constraint violation
if pgErr.Code == "23514" {
if pgErr.ConstraintName == "instances_name_check" {
return errors.New("instnace name not provided")
return errors.New("instance name not provided")
}
if pgErr.ConstraintName == "instances_id_check" {
return errors.New("instnace id not provided")
return errors.New("instance id not provided")
}
}
// duplicate
if pgErr.Code == "23505" {
if pgErr.ConstraintName == "instances_pkey" {
return errors.New("instnace id already exists")
return errors.New("instance id already exists")
}
}
}

View File

@@ -54,7 +54,7 @@ func TestCreateInstance(t *testing.T) {
}
return instance
}(),
err: errors.New("instnace name not provided"),
err: errors.New("instance name not provided"),
},
{
name: "adding same instance twice",
@@ -78,7 +78,7 @@ func TestCreateInstance(t *testing.T) {
require.NoError(t, err)
return &inst
},
err: errors.New("instnace id already exists"),
err: errors.New("instance id already exists"),
},
{
name: "adding instance with no id",
@@ -96,7 +96,7 @@ func TestCreateInstance(t *testing.T) {
}
return instance
}(),
err: errors.New("instnace id not provided"),
err: errors.New("instance id not provided"),
},
}
for _, tt := range tests {