leg: add unit tests for validations

Signed-off-by: diditclear <didyourupgradeclear@gmail.com>