mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
easy-xapi-supertest
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Created by karl on 14/07/15.
|
||||
*/
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="./easy-xapi-supertest.d.ts" />
|
||||
|
||||
import express = require('express');
|
||||
import eSupertest = require('easy-xapi-supertest');
|
||||
|
||||
var app = express();
|
||||
|
||||
var getAgent = eSupertest.getAgentFactory(app);
|
||||
|
||||
var agent = getAgent({
|
||||
user: 'Jack',
|
||||
role: 'user'
|
||||
});
|
||||
|
||||
var getAgent2 = eSupertest.getAgentFactory(app, function (user:string, role?:string) {
|
||||
return {
|
||||
user: user,
|
||||
role: role || 'user'
|
||||
}
|
||||
});
|
||||
|
||||
var agent = getAgent2('Jack');
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for easy-x-headers
|
||||
// Project: https://github.com/DeadAlready/easy-x-headers
|
||||
// Definitions by: Karl Düüna <https://github.com/DeadAlready/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "easy-xapi-supertest" {
|
||||
import express = require('express');
|
||||
|
||||
export interface BodyAgent {
|
||||
send(data: Object): any;
|
||||
attach(arg1: any, arg2?: any): any;
|
||||
}
|
||||
|
||||
export interface Agent {
|
||||
get(url:string): any;
|
||||
delete(url:string): any;
|
||||
post(url:string): BodyAgent;
|
||||
patch(url:string): BodyAgent;
|
||||
put(url:string): BodyAgent;
|
||||
}
|
||||
|
||||
interface getAgent {
|
||||
(...args:any[]): Agent
|
||||
}
|
||||
|
||||
export function getAgentFactory(app: express.Application, transform?: Function): getAgent;
|
||||
}
|
||||
Reference in New Issue
Block a user