diff options
author | EuAndreh <eu@euandre.org> | 2024-03-15 12:28:34 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-03-15 12:28:34 -0300 |
commit | 3558c8fd1dbedef8484c329e117390d1ffdc119f (patch) | |
tree | 4f26d906ce4db224ed2b864bb159e5040c0a962a /tests/js/hero.mjs | |
parent | src/hero.mjs: Add isValidLabel() (diff) | |
download | papod-3558c8fd1dbedef8484c329e117390d1ffdc119f.tar.gz papod-3558c8fd1dbedef8484c329e117390d1ffdc119f.tar.xz |
src/hero.mjs: Add comboForLabel()
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, |