-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
11 changed files
with
342 additions
and
368 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const { sleep } = require('../../../../utils'); | ||
const { scheduler } = require('node:timers/promises'); | ||
|
||
module.exports = app => { | ||
app.get('/', async function() { | ||
this.logger.debug('hi %s %s', this.method, this.url); | ||
// wait for writing to file | ||
await sleep(1000); | ||
await scheduler.wait(1000); | ||
this.body = 'ok'; | ||
}); | ||
}; |
18 changes: 8 additions & 10 deletions
18
test/lib/core/context_httpclient.test.js → test/lib/core/context_httpclient.test.ts
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
import { strict as assert } from 'node:assert'; | ||
import { createApp, MockApplication } from '../../utils.js'; | ||
|
||
describe('test/lib/core/context_performance_starttime.test.ts', () => { | ||
let app: MockApplication; | ||
|
||
before(() => { | ||
app = createApp('apps/app-enablePerformanceTimer-true'); | ||
return app.ready(); | ||
}); | ||
|
||
it('should set ctx.performanceStarttime', () => { | ||
const ctx = app.mockContext(); | ||
assert(ctx.performanceStarttime); | ||
assert.equal(typeof ctx.performanceStarttime, 'number'); | ||
assert(typeof ctx.performanceStarttime === 'number' && ctx.performanceStarttime > 0); | ||
}); | ||
|
||
it('should use ctx.performanceStarttime on controller', async () => { | ||
const res = await app.httpRequest() | ||
.get('/'); | ||
assert.equal(res.status, 200); | ||
assert.match(res.text, /hello performanceStarttime: \d+\.\d+/); | ||
}); | ||
}); |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.