Commit 92e96843 authored by Alexander Urban's avatar Alexander Urban

Unit tests revised: Response event

parent 5ed7fd8c
Pipeline #2067 passed with stage
in 24 seconds
......@@ -51,12 +51,13 @@ describe( "Mock-up service for HTTP", () => {
} );
it( "emits event 'response' on having responded to some incoming request", () => {
let request, response, content;
let request, response, content, rule;
Mock.once( "response", ( _request, _response, _content ) => {
Mock.once( "response", ( _request, _response, _content, _rule ) => {
request = _request;
response = _response;
content = _content;
rule = _rule;
} );
Mock.once( "error", console.error );
......@@ -71,6 +72,8 @@ describe( "Mock-up service for HTTP", () => {
response.should.be.Object().and.have.property( "write" ).which.is.a.Function();
content.should.be.Array().which.is.not.empty();
Buffer.concat( content ).toString( "utf8" ).should.be.String().which.is.equal( "Hello tester!" );
rule.should.be.an.Object().and.have.property( "source" ).which.is.a.String();
rule.source.trim().should.equal( "/test" );
} );
} );
} );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment