diff options
Diffstat (limited to 'tests/js/hero.mjs')
-rw-r--r-- | tests/js/hero.mjs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/js/hero.mjs b/tests/js/hero.mjs index 4330cb2..d9c01d4 100644 --- a/tests/js/hero.mjs +++ b/tests/js/hero.mjs @@ -20,6 +20,7 @@ import { normalizeSegments, pathToSegments, hasPathParams, + isValidLabel, addRoute, findStaticHandler, firstParamMatch, @@ -576,6 +577,23 @@ const test_hasPathParams = async t => { }); }; +const test_isValidLabel = async t => { + t.start("isValidLabel()"); + + await t.test("typo examples", () => { + assert.ok(!isValidLabel("get")); + assert.ok(!isValidLabel("WebSocket")); + assert.ok(!isValidLabel("WEBSOCKETS")); + assert.ok(!isValidLabel("ws")); + }); + + await t.test("valid usages", () => { + assert.ok(isValidLabel("GET")); + assert.ok(isValidLabel("PUT")); + assert.ok(isValidLabel("WEBSOCKET")); + }); +}; + const test_addRoute = async t => { t.start("addRoute()"); @@ -1787,6 +1805,7 @@ await runner.runTests([ test_normalizeSegments, test_pathToSegments, test_hasPathParams, + test_isValidLabel, test_addRoute, test_findStaticHandler, test_firstParamMatch, |