@loopback/testlab 4.0.0-alpha.7 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +411 -20
- package/dist/client.d.ts +25 -0
- package/dist/client.js +40 -0
- package/dist/client.js.map +1 -0
- package/dist/expect.d.ts +2 -0
- package/{lib/testlab.js → dist/expect.js} +4 -11
- package/dist/expect.js.map +1 -0
- package/dist/http-error-logger.d.ts +9 -0
- package/dist/http-error-logger.js +23 -0
- package/dist/http-error-logger.js.map +1 -0
- package/dist/http-server-config.d.ts +26 -0
- package/dist/http-server-config.js +76 -0
- package/dist/http-server-config.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/request.d.ts +13 -0
- package/dist/request.js +40 -0
- package/dist/request.js.map +1 -0
- package/dist/shot.d.ts +24 -0
- package/dist/shot.js +108 -0
- package/dist/shot.js.map +1 -0
- package/dist/sinon.d.ts +25 -0
- package/dist/sinon.js +35 -0
- package/dist/sinon.js.map +1 -0
- package/dist/skip.d.ts +49 -0
- package/dist/skip.js +65 -0
- package/dist/skip.js.map +1 -0
- package/dist/test-sandbox.d.ts +89 -0
- package/dist/test-sandbox.js +139 -0
- package/dist/test-sandbox.js.map +1 -0
- package/dist/to-json.d.ts +23 -0
- package/dist/to-json.js +12 -0
- package/dist/to-json.js.map +1 -0
- package/dist/validate-api-spec.d.ts +1 -0
- package/dist/validate-api-spec.js +16 -0
- package/dist/validate-api-spec.js.map +1 -0
- package/fixtures/README.md +9 -0
- package/fixtures/cert.pem +21 -0
- package/fixtures/copy-me.txt +1 -0
- package/fixtures/key.pem +28 -0
- package/fixtures/pfx.pfx +0 -0
- package/package.json +46 -32
- package/should-as-function.d.ts +12 -3
- package/src/client.ts +57 -0
- package/src/expect.ts +15 -0
- package/src/http-error-logger.ts +35 -0
- package/src/http-server-config.ts +97 -0
- package/src/index.ts +37 -0
- package/src/request.ts +45 -0
- package/src/shot.ts +191 -0
- package/src/sinon.ts +38 -0
- package/src/skip.ts +76 -0
- package/src/test-sandbox.ts +181 -0
- package/src/to-json.ts +54 -0
- package/src/validate-api-spec.ts +14 -0
- package/index.d.ts +0 -6
- package/index.js +0 -9
- package/lib/client.d.ts +0 -23
- package/lib/client.js +0 -34
- package/lib/client.js.map +0 -1
- package/lib/shot.d.ts +0 -17
- package/lib/shot.js +0 -36
- package/lib/shot.js.map +0 -1
- package/lib/testlab.d.ts +0 -9
- package/lib/testlab.js.map +0 -1
- package/lib/validate-api-spec.d.ts +0 -2
- package/lib/validate-api-spec.js +0 -29
- package/lib/validate-api-spec.js.map +0 -1
- package/lib6/client.d.ts +0 -23
- package/lib6/client.js +0 -44
- package/lib6/client.js.map +0 -1
- package/lib6/shot.d.ts +0 -17
- package/lib6/shot.js +0 -36
- package/lib6/shot.js.map +0 -1
- package/lib6/testlab.d.ts +0 -9
- package/lib6/testlab.js +0 -22
- package/lib6/testlab.js.map +0 -1
- package/lib6/validate-api-spec.d.ts +0 -2
- package/lib6/validate-api-spec.js +0 -39
- package/lib6/validate-api-spec.js.map +0 -1
package/lib/shot.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="shot" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { ServerRequest, ServerResponse } from 'http';
|
|
4
|
-
import { RequestOptions as ShotRequestOptions, ResponseObject, inject } from 'shot';
|
|
5
|
-
export { inject, ShotRequestOptions };
|
|
6
|
-
export declare const ShotRequest: ShotRequestCtor;
|
|
7
|
-
export declare const ShotResponse: ShotResponseCtor;
|
|
8
|
-
export declare type ShotRequestCtor = new (options: ShotRequestOptions) => ServerRequest;
|
|
9
|
-
export declare type ShotCallback = (response: ResponseObject) => void;
|
|
10
|
-
export declare type ShotResponseCtor = new (request: ServerRequest, onEnd: ShotCallback) => ServerResponse;
|
|
11
|
-
export declare type ShotObservedResponse = ResponseObject;
|
|
12
|
-
export interface ShotResponseMock {
|
|
13
|
-
request: ServerRequest;
|
|
14
|
-
response: ServerResponse;
|
|
15
|
-
result: Promise<ShotObservedResponse>;
|
|
16
|
-
}
|
|
17
|
-
export declare function mockResponse(requestOptions?: ShotRequestOptions): ShotResponseMock;
|
package/lib/shot.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2013,2017. All Rights Reserved.
|
|
3
|
-
// Node module: @loopback/testlab
|
|
4
|
-
// This file is licensed under the MIT License.
|
|
5
|
-
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const util = require("util");
|
|
8
|
-
const shot_1 = require("shot");
|
|
9
|
-
exports.inject = shot_1.inject;
|
|
10
|
-
// tslint:disable-next-line:variable-name
|
|
11
|
-
exports.ShotRequest = require('shot/lib/request');
|
|
12
|
-
// tslint:disable-next-line:variable-name
|
|
13
|
-
exports.ShotResponse = require('shot/lib/response');
|
|
14
|
-
function mockResponse(requestOptions = { url: '/' }) {
|
|
15
|
-
const request = new exports.ShotRequest(requestOptions);
|
|
16
|
-
let response;
|
|
17
|
-
let result = new Promise(resolve => {
|
|
18
|
-
response = new exports.ShotResponse(request, resolve);
|
|
19
|
-
});
|
|
20
|
-
// Setup custom inspect functions to make test error messages easier to read
|
|
21
|
-
const inspectOpts = (depth) => util.inspect(requestOptions, { depth });
|
|
22
|
-
defineCustomInspect(request, depth => `[ShotRequest with options ${inspectOpts(depth)}]`);
|
|
23
|
-
defineCustomInspect(response, depth => `[ShotResponse for request with options ${inspectOpts(depth)}]`);
|
|
24
|
-
result = result.then(r => {
|
|
25
|
-
defineCustomInspect(r, depth => `[ShotObservedResponse for request with options ${inspectOpts(depth)}]`);
|
|
26
|
-
return r;
|
|
27
|
-
});
|
|
28
|
-
return { request, response: response, result };
|
|
29
|
-
}
|
|
30
|
-
exports.mockResponse = mockResponse;
|
|
31
|
-
// tslint:disable:no-any
|
|
32
|
-
function defineCustomInspect(obj, inspectFn) {
|
|
33
|
-
obj.inspect = obj.toString = inspectFn;
|
|
34
|
-
}
|
|
35
|
-
// tslint:enable:no-any
|
|
36
|
-
//# sourceMappingURL=shot.js.map
|
package/lib/shot.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shot.js","sourceRoot":"","sources":["../src/shot.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;AAQhE,6BAA6B;AAE7B,+BAIc;AAEN,iBAHN,aAAM,CAGM;AAEd,yCAAyC;AAC5B,QAAA,WAAW,GAAoB,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAExE,yCAAyC;AAC5B,QAAA,YAAY,GAAqB,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAkB3E,sBACE,iBAAqC,EAAC,GAAG,EAAE,GAAG,EAAC;IAE/C,MAAM,OAAO,GAAG,IAAI,mBAAW,CAAC,cAAc,CAAC,CAAC;IAChD,IAAI,QAAoC,CAAC;IACzC,IAAI,MAAM,GAAG,IAAI,OAAO,CAAuB,OAAO;QACpD,QAAQ,GAAG,IAAI,oBAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,4EAA4E;IAC5E,MAAM,WAAW,GAAG,CAAC,KAAa,KAAK,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;IAC7E,mBAAmB,CACjB,OAAO,EACP,KAAK,IAAI,6BAA6B,WAAW,CAAC,KAAK,CAAC,GAAG,CAC5D,CAAC;IAEF,mBAAmB,CACjB,QAAQ,EACR,KAAK,IAAI,0CAA0C,WAAW,CAAC,KAAK,CAAC,GAAG,CACzE,CAAC;IAEF,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,mBAAmB,CACjB,CAAC,EACD,KAAK,IACH,kDAAkD,WAAW,CAAC,KAAK,CAAC,GAAG,CAC1E,CAAC;QACF,MAAM,CAAC,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAS,EAAE,MAAM,EAAC,CAAC;AAChD,CAAC;AA/BD,oCA+BC;AAED,wBAAwB;AACxB,6BAA6B,GAAQ,EAAE,SAAgC;IACrE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC;AACzC,CAAC;AACD,uBAAuB"}
|
package/lib/testlab.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference path="../should-as-function.d.ts" />
|
|
2
|
-
import 'should-sinon';
|
|
3
|
-
import sinon = require('sinon');
|
|
4
|
-
import { SinonSpy } from 'sinon';
|
|
5
|
-
export declare const expect: Internal;
|
|
6
|
-
export { sinon, SinonSpy };
|
|
7
|
-
export * from './client';
|
|
8
|
-
export * from './shot';
|
|
9
|
-
export * from './validate-api-spec';
|
package/lib/testlab.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testlab.js","sourceRoot":"","sources":["../src/testlab.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;;;AAEhE,mDAAmD;AAEnD,MAAM,gBAAgB,GAAa,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACjE,wBAAsB;AAEtB,+BAAgC;AAQxB,sBAAK;AALb,gBAAgB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS;IACrC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,gBAAgB,CAAC;AAGvC,8BAAyB;AACzB,4BAAuB;AACvB,yCAAoC"}
|
package/lib/validate-api-spec.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2013,2017. All Rights Reserved.
|
|
3
|
-
// Node module: @loopback/testlab
|
|
4
|
-
// This file is licensed under the MIT License.
|
|
5
|
-
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const SwaggerParser = require("swagger-parser");
|
|
8
|
-
async function validateApiSpec(spec) {
|
|
9
|
-
const opts = {
|
|
10
|
-
$refs: {
|
|
11
|
-
internal: false,
|
|
12
|
-
external: false,
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
// workaround for unhelpful message returned by SwaggerParser
|
|
16
|
-
// TODO(bajtos) contribute these improvements to swagger-parser
|
|
17
|
-
if (!spec.swagger) {
|
|
18
|
-
throw new Error('Missing required property: swagger at #/');
|
|
19
|
-
}
|
|
20
|
-
if (!spec.info) {
|
|
21
|
-
throw new Error('Missing required property: info at #/');
|
|
22
|
-
}
|
|
23
|
-
if (!spec.paths) {
|
|
24
|
-
throw new Error('Missing required property: paths at #/');
|
|
25
|
-
}
|
|
26
|
-
await SwaggerParser.validate(spec, opts);
|
|
27
|
-
}
|
|
28
|
-
exports.validateApiSpec = validateApiSpec;
|
|
29
|
-
//# sourceMappingURL=validate-api-spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-api-spec.js","sourceRoot":"","sources":["../src/validate-api-spec.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;AAEhE,gDAAgD;AAGzC,KAAK,0BAA0B,IAAiB;IACrD,MAAM,IAAI,GAA0B;QAClC,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,KAAK;SAChB;KACuB,CAAC;IAE3B,6DAA6D;IAC7D,+DAA+D;IAC/D,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAvBD,0CAuBC"}
|
package/lib6/client.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="supertest" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import * as http from 'http';
|
|
4
|
-
import supertest = require('supertest');
|
|
5
|
-
export { supertest };
|
|
6
|
-
export declare type Client = supertest.SuperTest<supertest.Test>;
|
|
7
|
-
/**
|
|
8
|
-
* Create a SuperTest client connected to an HTTP server listening
|
|
9
|
-
* on an ephemeral port and calling `handler` to handle incoming requests.
|
|
10
|
-
* @param handler
|
|
11
|
-
*/
|
|
12
|
-
export declare function createClientForHandler(handler: (req: http.ServerRequest, res: http.ServerResponse) => void): Client;
|
|
13
|
-
export interface Server {
|
|
14
|
-
config: {
|
|
15
|
-
port: number;
|
|
16
|
-
};
|
|
17
|
-
start(): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
export declare function createClientForServer(server: Server): Promise<Client>;
|
|
20
|
-
export interface Application {
|
|
21
|
-
handleHttp(req: http.ServerRequest, res: http.ServerResponse): void;
|
|
22
|
-
}
|
|
23
|
-
export declare function createClientForApp(app: Application): Client;
|
package/lib6/client.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2013,2017. All Rights Reserved.
|
|
3
|
-
// Node module: @loopback/testlab
|
|
4
|
-
// This file is licensed under the MIT License.
|
|
5
|
-
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
/*
|
|
16
|
-
* HTTP client utilities
|
|
17
|
-
*/
|
|
18
|
-
const http = require("http");
|
|
19
|
-
const supertest = require("supertest");
|
|
20
|
-
exports.supertest = supertest;
|
|
21
|
-
/**
|
|
22
|
-
* Create a SuperTest client connected to an HTTP server listening
|
|
23
|
-
* on an ephemeral port and calling `handler` to handle incoming requests.
|
|
24
|
-
* @param handler
|
|
25
|
-
*/
|
|
26
|
-
function createClientForHandler(handler) {
|
|
27
|
-
const server = http.createServer(handler);
|
|
28
|
-
return supertest(server);
|
|
29
|
-
}
|
|
30
|
-
exports.createClientForHandler = createClientForHandler;
|
|
31
|
-
function createClientForServer(server) {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
yield server.start();
|
|
34
|
-
const url = `http://127.0.0.1:${server.config.port}`;
|
|
35
|
-
// TODO(bajtos) Find a way how to stop the server after all tests are done
|
|
36
|
-
return supertest(url);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
exports.createClientForServer = createClientForServer;
|
|
40
|
-
function createClientForApp(app) {
|
|
41
|
-
return createClientForHandler(app.handleHttp);
|
|
42
|
-
}
|
|
43
|
-
exports.createClientForApp = createClientForApp;
|
|
44
|
-
//# sourceMappingURL=client.js.map
|
package/lib6/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;;;;;;;;AAEhE;;GAEG;AAEH,6BAA6B;AAC7B,uCAAwC;AAEhC,8BAAS;AAIjB;;;;GAIG;AACH,gCACE,OAAoE;IAEpE,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AALD,wDAKC;AAOD,+BAA4C,MAAc;;QACxD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,oBAAoB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrD,0EAA0E;QAC1E,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CAAA;AALD,sDAKC;AAMD,4BAAmC,GAAgB;IACjD,MAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAChD,CAAC;AAFD,gDAEC"}
|
package/lib6/shot.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="shot" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { ServerRequest, ServerResponse } from 'http';
|
|
4
|
-
import { RequestOptions as ShotRequestOptions, ResponseObject, inject } from 'shot';
|
|
5
|
-
export { inject, ShotRequestOptions };
|
|
6
|
-
export declare const ShotRequest: ShotRequestCtor;
|
|
7
|
-
export declare const ShotResponse: ShotResponseCtor;
|
|
8
|
-
export declare type ShotRequestCtor = new (options: ShotRequestOptions) => ServerRequest;
|
|
9
|
-
export declare type ShotCallback = (response: ResponseObject) => void;
|
|
10
|
-
export declare type ShotResponseCtor = new (request: ServerRequest, onEnd: ShotCallback) => ServerResponse;
|
|
11
|
-
export declare type ShotObservedResponse = ResponseObject;
|
|
12
|
-
export interface ShotResponseMock {
|
|
13
|
-
request: ServerRequest;
|
|
14
|
-
response: ServerResponse;
|
|
15
|
-
result: Promise<ShotObservedResponse>;
|
|
16
|
-
}
|
|
17
|
-
export declare function mockResponse(requestOptions?: ShotRequestOptions): ShotResponseMock;
|
package/lib6/shot.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2013,2017. All Rights Reserved.
|
|
3
|
-
// Node module: @loopback/testlab
|
|
4
|
-
// This file is licensed under the MIT License.
|
|
5
|
-
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const util = require("util");
|
|
8
|
-
const shot_1 = require("shot");
|
|
9
|
-
exports.inject = shot_1.inject;
|
|
10
|
-
// tslint:disable-next-line:variable-name
|
|
11
|
-
exports.ShotRequest = require('shot/lib/request');
|
|
12
|
-
// tslint:disable-next-line:variable-name
|
|
13
|
-
exports.ShotResponse = require('shot/lib/response');
|
|
14
|
-
function mockResponse(requestOptions = { url: '/' }) {
|
|
15
|
-
const request = new exports.ShotRequest(requestOptions);
|
|
16
|
-
let response;
|
|
17
|
-
let result = new Promise(resolve => {
|
|
18
|
-
response = new exports.ShotResponse(request, resolve);
|
|
19
|
-
});
|
|
20
|
-
// Setup custom inspect functions to make test error messages easier to read
|
|
21
|
-
const inspectOpts = (depth) => util.inspect(requestOptions, { depth });
|
|
22
|
-
defineCustomInspect(request, depth => `[ShotRequest with options ${inspectOpts(depth)}]`);
|
|
23
|
-
defineCustomInspect(response, depth => `[ShotResponse for request with options ${inspectOpts(depth)}]`);
|
|
24
|
-
result = result.then(r => {
|
|
25
|
-
defineCustomInspect(r, depth => `[ShotObservedResponse for request with options ${inspectOpts(depth)}]`);
|
|
26
|
-
return r;
|
|
27
|
-
});
|
|
28
|
-
return { request, response: response, result };
|
|
29
|
-
}
|
|
30
|
-
exports.mockResponse = mockResponse;
|
|
31
|
-
// tslint:disable:no-any
|
|
32
|
-
function defineCustomInspect(obj, inspectFn) {
|
|
33
|
-
obj.inspect = obj.toString = inspectFn;
|
|
34
|
-
}
|
|
35
|
-
// tslint:enable:no-any
|
|
36
|
-
//# sourceMappingURL=shot.js.map
|
package/lib6/shot.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shot.js","sourceRoot":"","sources":["../src/shot.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;AAQhE,6BAA6B;AAE7B,+BAIc;AAEN,iBAHN,aAAM,CAGM;AAEd,yCAAyC;AAC5B,QAAA,WAAW,GAAoB,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAExE,yCAAyC;AAC5B,QAAA,YAAY,GAAqB,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAkB3E,sBACE,iBAAqC,EAAC,GAAG,EAAE,GAAG,EAAC;IAE/C,MAAM,OAAO,GAAG,IAAI,mBAAW,CAAC,cAAc,CAAC,CAAC;IAChD,IAAI,QAAoC,CAAC;IACzC,IAAI,MAAM,GAAG,IAAI,OAAO,CAAuB,OAAO;QACpD,QAAQ,GAAG,IAAI,oBAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,4EAA4E;IAC5E,MAAM,WAAW,GAAG,CAAC,KAAa,KAAK,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;IAC7E,mBAAmB,CACjB,OAAO,EACP,KAAK,IAAI,6BAA6B,WAAW,CAAC,KAAK,CAAC,GAAG,CAC5D,CAAC;IAEF,mBAAmB,CACjB,QAAQ,EACR,KAAK,IAAI,0CAA0C,WAAW,CAAC,KAAK,CAAC,GAAG,CACzE,CAAC;IAEF,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,mBAAmB,CACjB,CAAC,EACD,KAAK,IACH,kDAAkD,WAAW,CAAC,KAAK,CAAC,GAAG,CAC1E,CAAC;QACF,MAAM,CAAC,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAS,EAAE,MAAM,EAAC,CAAC;AAChD,CAAC;AA/BD,oCA+BC;AAED,wBAAwB;AACxB,6BAA6B,GAAQ,EAAE,SAAgC;IACrE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC;AACzC,CAAC;AACD,uBAAuB"}
|
package/lib6/testlab.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference path="../should-as-function.d.ts" />
|
|
2
|
-
import 'should-sinon';
|
|
3
|
-
import sinon = require('sinon');
|
|
4
|
-
import { SinonSpy } from 'sinon';
|
|
5
|
-
export declare const expect: Internal;
|
|
6
|
-
export { sinon, SinonSpy };
|
|
7
|
-
export * from './client';
|
|
8
|
-
export * from './shot';
|
|
9
|
-
export * from './validate-api-spec';
|
package/lib6/testlab.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2013,2017. All Rights Reserved.
|
|
3
|
-
// Node module: @loopback/testlab
|
|
4
|
-
// This file is licensed under the MIT License.
|
|
5
|
-
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
-
function __export(m) {
|
|
7
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
/// <reference path="../should-as-function.d.ts" />
|
|
11
|
-
const shouldAsFunction = require('should/as-function');
|
|
12
|
-
require("should-sinon");
|
|
13
|
-
const sinon = require("sinon");
|
|
14
|
-
exports.sinon = sinon;
|
|
15
|
-
shouldAsFunction.use((should, assertion) => {
|
|
16
|
-
assertion.addChain('to');
|
|
17
|
-
});
|
|
18
|
-
exports.expect = shouldAsFunction;
|
|
19
|
-
__export(require("./client"));
|
|
20
|
-
__export(require("./shot"));
|
|
21
|
-
__export(require("./validate-api-spec"));
|
|
22
|
-
//# sourceMappingURL=testlab.js.map
|
package/lib6/testlab.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testlab.js","sourceRoot":"","sources":["../src/testlab.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;;;AAEhE,mDAAmD;AAEnD,MAAM,gBAAgB,GAAa,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACjE,wBAAsB;AAEtB,+BAAgC;AAQxB,sBAAK;AALb,gBAAgB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS;IACrC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,gBAAgB,CAAC;AAGvC,8BAAyB;AACzB,4BAAuB;AACvB,yCAAoC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2013,2017. All Rights Reserved.
|
|
3
|
-
// Node module: @loopback/testlab
|
|
4
|
-
// This file is licensed under the MIT License.
|
|
5
|
-
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const SwaggerParser = require("swagger-parser");
|
|
16
|
-
function validateApiSpec(spec) {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const opts = {
|
|
19
|
-
$refs: {
|
|
20
|
-
internal: false,
|
|
21
|
-
external: false,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
// workaround for unhelpful message returned by SwaggerParser
|
|
25
|
-
// TODO(bajtos) contribute these improvements to swagger-parser
|
|
26
|
-
if (!spec.swagger) {
|
|
27
|
-
throw new Error('Missing required property: swagger at #/');
|
|
28
|
-
}
|
|
29
|
-
if (!spec.info) {
|
|
30
|
-
throw new Error('Missing required property: info at #/');
|
|
31
|
-
}
|
|
32
|
-
if (!spec.paths) {
|
|
33
|
-
throw new Error('Missing required property: paths at #/');
|
|
34
|
-
}
|
|
35
|
-
yield SwaggerParser.validate(spec, opts);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
exports.validateApiSpec = validateApiSpec;
|
|
39
|
-
//# sourceMappingURL=validate-api-spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-api-spec.js","sourceRoot":"","sources":["../src/validate-api-spec.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;;;;;;;;AAEhE,gDAAgD;AAGhD,yBAAsC,IAAiB;;QACrD,MAAM,IAAI,GAA0B;YAClC,KAAK,EAAE;gBACL,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,KAAK;aAChB;SACuB,CAAC;QAE3B,6DAA6D;QAC7D,+DAA+D;QAC/D,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;CAAA;AAvBD,0CAuBC"}
|