generated from fastify/skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bytesPerSecond function generated by request, allow async byteP…
…erSecond functions (#8) * feat: bytesPerSecond function generated by request, allow async bytesPerSecond functions * run test sequential * fix remarks * make tests less flaky
- Loading branch information
Showing
12 changed files
with
525 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
files: | ||
- test/**/*.test.js | ||
|
||
jobs: 1 |
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,13 @@ | ||
'use strict' | ||
|
||
/* istanbul ignore next */ | ||
const AsyncFunctionConstructor = (async () => {}).constructor | ||
|
||
/** | ||
* A function that returns true if the given function is an async function. | ||
*/ | ||
const isAsyncFunction = (fn) => fn.constructor === AsyncFunctionConstructor | ||
|
||
module.exports = { | ||
isAsyncFunction | ||
} |
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,14 @@ | ||
'use strict' | ||
|
||
const { test } = require('tap') | ||
const { isAsyncFunction } = require('../../lib/is-async-function.js') | ||
|
||
test('isAsyncFunction returns true for async functions', (t) => { | ||
t.plan(1) | ||
t.ok(isAsyncFunction(async () => { })) | ||
}) | ||
|
||
test('isAsyncFunction returns false for non-async functions', (t) => { | ||
t.plan(1) | ||
t.notOk(isAsyncFunction(() => { })) | ||
}) |
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
Oops, something went wrong.