-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const path = require('path') | ||
const test = require('tape') | ||
const router = require('..') | ||
|
||
// use both ts and js scripts | ||
const config = {ext: ['.js', '.ts']} | ||
|
||
let match = router(path.join(__dirname, '/fixtures/extensions'), config) | ||
|
||
test('includes the index.js', t => { | ||
t.plan(2) | ||
let req = { url: '/', method: 'GET' } | ||
t.equal(typeof match(req), 'function', 'returns the route function') | ||
t.equal(match(req)(), 'index', 'route function is callable') | ||
}) | ||
|
||
test('includes the typescript file', t => { | ||
t.plan(2) | ||
let req = { url: '/typescript', method: 'GET' } | ||
t.equal(typeof match(req), 'function', 'returns the route function') | ||
t.equal(match(req)(), 'typescript', 'route function is callable') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = () => 'index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = () => 'typescript' |