Added command length tests for DECRBY command. Updated godoc comment for DecrBy embedded API method.

This commit is contained in:
Kelvin Mwinuka
2024-06-25 12:53:19 +08:00
parent 51100a1700
commit 9e49c35116
2 changed files with 23 additions and 2 deletions

View File

@@ -2324,6 +2324,27 @@ func Test_Generic(t *testing.T) {
expectedResponse: 3,
expectedError: nil,
},
{
name: "5. Command too short",
key: "DecrByKey5",
presetValue: nil,
command: []resp.Value{resp.StringValue("DECRBY"), resp.StringValue("DecrByKey5")},
expectedResponse: 0,
expectedError: errors.New(constants.WrongArgsResponse),
},
{
name: "6. Command too long",
key: "DecrKey6",
presetValue: nil,
command: []resp.Value{
resp.StringValue("DECRBY"),
resp.StringValue("DecrKey6"),
resp.StringValue("3"),
resp.StringValue("extra_arg"),
},
expectedResponse: 0,
expectedError: errors.New(constants.WrongArgsResponse),
},
}
for _, test := range tests {