authelia/test/unitary/mocks/express.ts

31 lines
549 B
TypeScript
Raw Normal View History

2017-05-20 20:55:37 +00:00
import sinon = require("sinon");
2017-05-20 23:15:34 +00:00
export interface RequestMock {
app?: any;
body?: any;
session?: any;
headers?: any;
}
export interface ResponseMock {
send: sinon.SinonStub | sinon.SinonSpy;
status: sinon.SinonStub;
json: sinon.SinonStub;
}
export function RequestMock(): RequestMock {
return {
app: {
get: sinon.stub()
}
};
}
export function ResponseMock(): ResponseMock {
return {
send: sinon.stub(),
status: sinon.stub(),
json: sinon.stub()
};
}