feat(hsm): first version of hsm library functional
This commit is contained in:
12 files changed
+1371
-46
No files matched your search
+14
-11
@@ -1,4 +1,4 @@
|
||||
require "src.util.validators"
|
||||
require "lib.util.validators"
|
||||
|
||||
describe "validators", ->
|
||||
describe "is_valid_timer", ->
|
||||
@@ -27,14 +27,17 @@ describe "validators", ->
|
||||
result = is_valid_timer 3.14
|
||||
assert.is_true result
|
||||
|
||||
it "errors when passed a non-number (string)", ->
|
||||
assert.has_error => is_valid_timer "10"
|
||||
it "returns false when passed a non-number (string)", ->
|
||||
result = is_valid_timer "10"
|
||||
assert.is_false result
|
||||
|
||||
it "errors when passed a non-number (boolean true)", ->
|
||||
assert.has_error => is_valid_timer true
|
||||
it "returns false when passed a non-number (boolean true)", ->
|
||||
result = is_valid_timer true
|
||||
assert.has_false result
|
||||
|
||||
it "errors when passed a non-number (table)", ->
|
||||
assert.has_error => is_valid_timer { foo: "bar" }
|
||||
it "returns false when passed a non-number (table)", ->
|
||||
result = is_valid_timer { foo: "bar" }
|
||||
assert.has_false result
|
||||
|
||||
describe "is_valid_symbol", ->
|
||||
-- When the input is not a string, it should immediately return false.
|
||||
@@ -75,17 +78,17 @@ describe "validators", ->
|
||||
result = is_valid_symbol "AbCdEf"
|
||||
assert.is_true result
|
||||
|
||||
it "returns false for a string with numbers", ->
|
||||
it "returns true for a string with numbers", ->
|
||||
result = is_valid_symbol "abc123"
|
||||
assert.is_false result
|
||||
assert.is_true result
|
||||
|
||||
it "returns false for a string with punctuation", ->
|
||||
result = is_valid_symbol "hello!"
|
||||
assert.is_false result
|
||||
|
||||
it "returns false for a string with an underscore", ->
|
||||
it "returns true for a string with an underscore", ->
|
||||
result = is_valid_symbol "a_b"
|
||||
assert.is_false result
|
||||
assert.is_true result
|
||||
|
||||
it "returns false for a string containing whitespace", ->
|
||||
result = is_valid_symbol "abc def"
|
||||
|
||||
Reference in new issue
Block a user