diff options
author | Omar Rizwan <omar@omar.website> | 2021-03-21 15:35:01 -0700 |
---|---|---|
committer | Omar Rizwan <omar@omar.website> | 2021-03-21 15:35:01 -0700 |
commit | be519afe5fdd956ac092d7ac01f161541e3db3f8 (patch) | |
tree | f649668417391ff17939984638c98c75a2b55bc2 /test/test.js | |
parent | 57726b4354a02f85101d4369d05fd7629be68ea3 (diff) | |
download | TabFS-be519afe5fdd956ac092d7ac01f161541e3db3f8.tar.gz TabFS-be519afe5fdd956ac092d7ac01f161541e3db3f8.zip |
extension,test: Start on simplifying routing.
Introduces a 'named variable' syntax so we can remove all the manual
indexing into path components / converting to int in individual fs
ops.
Also rewrites the route finding to use regex: all routes are compiled
to regexes, then the route finder just walks through them all until it
hits a match.
Doesn't fully work yet; JS test passes.
Diffstat (limited to 'test/test.js')
-rw-r--r-- | test/test.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test.js b/test/test.js index 1288bf4..6376885 100644 --- a/test/test.js +++ b/test/test.js @@ -6,7 +6,7 @@ global.chrome = {}; const {router, findRoute} = require('../extension/background'); (async () => { - const tabRoute = await router['/tabs/by-id/*'].readdir(); + const tabRoute = await router['/tabs/by-id/#TAB_ID'].readdir(); assert(['.', '..', 'url.txt', 'title.txt', 'text.txt'] .every(file => tabRoute.entries.includes(file))); @@ -16,6 +16,6 @@ const {router, findRoute} = require('../extension/background'); { entries: ['.', '..', 'create', 'by-id', 'by-title', 'last-focused'] }); - assert.deepEqual(findRoute('/tabs/by-id/TABID/url.txt'), - router['/tabs/by-id/*/url.txt']); + assert.deepEqual(findRoute('/tabs/by-id/10/url.txt'), + router['/tabs/by-id/#TAB_ID/url.txt']); })(); |