mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
add types for sinon-express-mock package (#16268)
* add types for sinon-express-mock package * remove sinon-express-mock package.json file
This commit is contained in:
committed by
Mohamed Hegazy
parent
90cd78deeb
commit
297a4960e5
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// Type definitions for sinon-express-mock 1.3
|
||||
// Project: https://github.com/danawoodman/sinon-express-mock#readme
|
||||
// Definitions by: Jared Chapiewsky <https://github.com/jpchip>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as Sinon from "sinon";
|
||||
|
||||
export namespace mockReq {
|
||||
interface MockReq {
|
||||
accepts: Sinon.SinonStub;
|
||||
acceptsCharsets: Sinon.SinonStub;
|
||||
acceptsEncodings: Sinon.SinonStub;
|
||||
acceptsLanguages: Sinon.SinonStub;
|
||||
body: object;
|
||||
flash: Sinon.SinonStub;
|
||||
get: Sinon.SinonStub;
|
||||
is: Sinon.SinonStub;
|
||||
params: object;
|
||||
query: object;
|
||||
session: object;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace mockRes {
|
||||
interface MockRes {
|
||||
append: Sinon.SinonStub;
|
||||
attachement: Sinon.SinonStub;
|
||||
clearCookie: Sinon.SinonStub;
|
||||
cookie: Sinon.SinonStub;
|
||||
download: Sinon.SinonStub;
|
||||
end: Sinon.SinonStub;
|
||||
format: object;
|
||||
get: Sinon.SinonStub;
|
||||
headersSent: Sinon.SinonStub;
|
||||
json: Sinon.SinonStub;
|
||||
jsonp: Sinon.SinonStub;
|
||||
links: Sinon.SinonStub;
|
||||
locals: object;
|
||||
location: Sinon.SinonStub;
|
||||
redirect: Sinon.SinonStub;
|
||||
render: Sinon.SinonStub;
|
||||
send: Sinon.SinonStub;
|
||||
sendFile: Sinon.SinonStub;
|
||||
sendStatus: Sinon.SinonStub;
|
||||
set: Sinon.SinonStub;
|
||||
status: Sinon.SinonStub;
|
||||
type: Sinon.SinonStub;
|
||||
vary: Sinon.SinonStub;
|
||||
}
|
||||
}
|
||||
|
||||
export function mockReq(options?: object): mockReq.MockReq;
|
||||
|
||||
export function mockRes(options?: object): mockRes.MockRes;
|
||||
@@ -0,0 +1,40 @@
|
||||
import * as Sinon from "sinon";
|
||||
import {mockReq, mockRes} from "sinon-express-mock";
|
||||
|
||||
const req = mockReq({});
|
||||
const acceptStub: Sinon.SinonStub = req.accepts();
|
||||
const acceptsCharsetsStub: Sinon.SinonStub = req.acceptsCharsets();
|
||||
const acceptsEncodingsStub: Sinon.SinonStub = req.acceptsEncodings();
|
||||
const acceptsLanguagesStub: Sinon.SinonStub = req.acceptsLanguages();
|
||||
const bodyObj: object = req.body;
|
||||
const flashStub: Sinon.SinonStub = req.flash();
|
||||
const getStub: Sinon.SinonStub = req.get();
|
||||
const isStub: Sinon.SinonStub = req.is();
|
||||
const paramsObj: object = req.params;
|
||||
const queryObj: object = req.query;
|
||||
const sessionObj: object = req.session;
|
||||
|
||||
const res = mockRes({});
|
||||
const append: Sinon.SinonStub = res.append();
|
||||
const attachement: Sinon.SinonStub = res.attachement();
|
||||
const clearCookie: Sinon.SinonStub = res.clearCookie();
|
||||
const cookie: Sinon.SinonStub = res.cookie();
|
||||
const download: Sinon.SinonStub = res.download();
|
||||
const end: Sinon.SinonStub = res.end();
|
||||
const format: object = res.format;
|
||||
const get: Sinon.SinonStub = res.get();
|
||||
const headersSent: Sinon.SinonStub = res.headersSent();
|
||||
const json: Sinon.SinonStub = res.json();
|
||||
const jsonp: Sinon.SinonStub = res.jsonp();
|
||||
const links: Sinon.SinonStub = res.links();
|
||||
const locals: object = res.locals;
|
||||
const location: Sinon.SinonStub = res.location();
|
||||
const redirect: Sinon.SinonStub = res.redirect();
|
||||
const render: Sinon.SinonStub = res.render();
|
||||
const send: Sinon.SinonStub = res.send();
|
||||
const sendFile: Sinon.SinonStub = res.sendFile();
|
||||
const sendStatus: Sinon.SinonStub = res.sendStatus();
|
||||
const set: Sinon.SinonStub = res.set();
|
||||
const status: Sinon.SinonStub = res.status();
|
||||
const type: Sinon.SinonStub = res.type();
|
||||
const vary: Sinon.SinonStub = res.vary();
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"sinon-express-mock-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user