-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add log to history and verbose mode
See manual for more informations
- Loading branch information
1 parent
3a0512c
commit fb12396
Showing
5 changed files
with
95 additions
and
1 deletion.
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
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,41 @@ | ||
import {Server} from '@'; | ||
|
||
const server = new Server(); | ||
|
||
describe('Log and verbose tests', function() { | ||
before(() => server.start()); | ||
afterEach(() => server.reset()); | ||
after(() => server.stop()); | ||
|
||
it('should log request/response/error', async function() { | ||
server.warnOnError(false); | ||
await fetch('/api/log'); | ||
server.respond.with.preset('default'); | ||
await fetch('/api/log'); | ||
|
||
server.history.logs.should.deep.equal([ | ||
'Request : GET http://localhost:9876/api/log', | ||
'FMF error: No fixtures defined', | ||
'Request : GET http://localhost:9876/api/log', | ||
'Response sent (200 OK)' | ||
]) | ||
}) | ||
|
||
it('should log and verbose request/response/error', async function() { | ||
sinon.spy(console, 'log'); | ||
|
||
server.warnOnError(false).verbose(true); | ||
await fetch('/api/log'); | ||
server.respond.with.preset('default'); | ||
await fetch('/api/log'); | ||
|
||
console.log.args.should.deep.equal([ // eslint-disable-line | ||
['Request : GET http://localhost:9876/api/log'], | ||
['FMF error: No fixtures defined'], | ||
['Request : GET http://localhost:9876/api/log'], | ||
['Response sent (200 OK)'] | ||
]) | ||
|
||
console.log.restore(); // eslint-disable-line | ||
}) | ||
}) |