Mainflux.mainflux/internal/testsutil
b1ackd0t e6f34e1546
NOISSUE - Fix WS Tests (#1927)
* feat(testsutil): Add function to generate random UUID

This commit adds a new function to the `common.go` file in the `testsutil` package. The function `GenerateRandomUUID` generates a random UUID using the `github.com/mainflux/mainflux/pkg/uuid` package. This function will be used in tests to generate unique identifiers for testing purposes.

The function is added to the existing `common.go` file in the `testsutil` package, which is used for common utilities in tests.

This change improves the testability of the codebase by providing a convenient way to generate random UUIDs for testing purposes.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(auth): add error constants

This commit adds two error constants, InvalidID and InvalidToken, to the auth package. These constants will be used to represent invalid ID and token values in the authentication service.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(ws): add validation for empty message payload

This commit adds a validation check for an empty message payload in the Publish method of the adapterService struct in the ws/adapter.go file. If the payload is empty, the method will now return an ErrFailedMessagePublish error. This validation ensures that only non-empty payloads are published.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(auth): add constant for invalid value

Added a constant named InvalidValue to the auth/mocks/service.go file. This constant is set to "invalid" and will be used to represent an invalid value in the codebase.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-10-18 22:40:55 +02:00
..
common.go NOISSUE - Fix WS Tests (#1927) 2023-10-18 22:40:55 +02:00