diff options
Diffstat (limited to 'tests/js/hero.mjs')
-rw-r--r-- | tests/js/hero.mjs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/js/hero.mjs b/tests/js/hero.mjs index d9c01d4..171e01f 100644 --- a/tests/js/hero.mjs +++ b/tests/js/hero.mjs @@ -21,6 +21,7 @@ import { pathToSegments, hasPathParams, isValidLabel, + comboForLabel, addRoute, findStaticHandler, firstParamMatch, @@ -594,6 +595,24 @@ const test_isValidLabel = async t => { }); }; +const test_comboForLabel = async t => { + t.start("comboForLabel()"); + + await t.test("websocket gets its own combo", () => { + assert.deepEqual( + comboForLabel("WEBSOCKET", "IGNORED"), + [ "websocket", "GET" ], + ); + }); + + await t.test("otherwise we get what pass", () => { + assert.deepEqual( + comboForLabel("not-websocket", "a-keyword"), + [ "a-keyword", "not-websocket" ], + ); + }); +}; + const test_addRoute = async t => { t.start("addRoute()"); @@ -1806,6 +1825,7 @@ await runner.runTests([ test_pathToSegments, test_hasPathParams, test_isValidLabel, + test_comboForLabel, test_addRoute, test_findStaticHandler, test_firstParamMatch, |