feat(hsm): first version of hsm library functional

This commit is contained in:
swaits committed 2025-02-04 17:22:18 -07:00
1 parent bdc28c4e83
commit c8bdcccf27
12 files changed
+1371 -46

No files matched your search

+14 -11
View File
@@ -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"