@tramvai/test-integration 2.112.0 → 2.117.0

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/README.md CHANGED
@@ -16,7 +16,7 @@ npm i --save-dev @tramvai/test-integration
16
16
 
17
17
  For testing requests to the tramvai app libraries [superagent](https://github.com/visionmedia/superagent) and [node-html-parser](https://github.com/taoqf/node-html-parser) are used under hood.
18
18
 
19
- Call of `app.request` sends requests to the app. All of the features of `superagent` are available.
19
+ Call of `app.request` sends requests to the app. All features of `superagent` are available.
20
20
 
21
21
  Call of `app.render` resolves to the HTML render that is returned from server while serving the request.
22
22
 
@@ -77,3 +77,35 @@ it('should work with mocker', async () => {
77
77
  await app.request('/api/').expect(500);
78
78
  });
79
79
  ```
80
+
81
+ ### Papi methods
82
+
83
+ All papi methods can be used in tests, for example:
84
+
85
+ ```ts
86
+ import { startCli } from '@tramvai/test-integration';
87
+
88
+ it('environment list', async () => {
89
+ const { papi } = await startCli('papi-example');
90
+
91
+ const response = await papi.apiList();
92
+ });
93
+ ```
94
+
95
+ Available methods are:
96
+
97
+ - clearCache;
98
+ - bundleInfo;
99
+ - apiList;
100
+
101
+ Also, you can use `publicPapi` (passes to `${serverUrl}/${appName}/papi/`) and `privatePapi` (passes to `${serverUrl}/${appName}/private/papi/`) properties to work with your own papi methods:
102
+
103
+ ```ts
104
+ import { startCli } from '@tramvai/test-integration';
105
+
106
+ it('custom method', async () => {
107
+ const { papi } = await startCli('papi-example');
108
+
109
+ const response = await papi.publicPapi('whatever');
110
+ });
111
+ ```
package/lib/app/papi.d.ts CHANGED
@@ -17,5 +17,6 @@ export declare const wrapPapi: ({ serverUrl, appName }: Options) => {
17
17
  } | undefined) => import("supertest").Test;
18
18
  clearCache: () => import("supertest").Test;
19
19
  bundleInfo: () => import("supertest").Test;
20
+ apiList: () => import("supertest").Test;
20
21
  };
21
22
  export {};
@@ -12,6 +12,9 @@ const wrapPapi = ({ serverUrl, appName }) => {
12
12
  bundleInfo: () => {
13
13
  return publicPapi('bundleInfo').expect(200);
14
14
  },
15
+ apiList: () => {
16
+ return publicPapi('apiList').expect(200);
17
+ },
15
18
  };
16
19
  };
17
20
 
package/lib/app/papi.js CHANGED
@@ -16,6 +16,9 @@ const wrapPapi = ({ serverUrl, appName }) => {
16
16
  bundleInfo: () => {
17
17
  return publicPapi('bundleInfo').expect(200);
18
18
  },
19
+ apiList: () => {
20
+ return publicPapi('apiList').expect(200);
21
+ },
19
22
  };
20
23
  };
21
24
 
@@ -42,6 +42,7 @@ export declare const startCli: (targetOrConfig: StartOptions['target'] | StartOp
42
42
  } | undefined) => import("supertest").Test;
43
43
  clearCache: () => import("supertest").Test;
44
44
  bundleInfo: () => import("supertest").Test;
45
+ apiList: () => import("supertest").Test;
45
46
  };
46
47
  mocker: {
47
48
  addMocks(api: string, mocks: Record<string, import("@tinkoff/mocker").MockConfig>): Promise<any>;
@@ -36,6 +36,7 @@ export declare const runFakeApp: (config: Partial<StartOptions['config']>, optio
36
36
  } | undefined) => import("supertest").Test;
37
37
  clearCache: () => import("supertest").Test;
38
38
  bundleInfo: () => import("supertest").Test;
39
+ apiList: () => import("supertest").Test;
39
40
  };
40
41
  mocker: {
41
42
  addMocks(api: string, mocks: Record<string, import("@tinkoff/mocker").MockConfig>): Promise<any>;
@@ -35,6 +35,7 @@ export declare const runRealApp: (tramvaiConfigRoot: string, appName: string, op
35
35
  } | undefined) => import("supertest").Test;
36
36
  clearCache: () => import("supertest").Test;
37
37
  bundleInfo: () => import("supertest").Test;
38
+ apiList: () => import("supertest").Test;
38
39
  };
39
40
  mocker: {
40
41
  addMocks(api: string, mocks: Record<string, import("@tinkoff/mocker").MockConfig>): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/test-integration",
3
- "version": "2.112.0",
3
+ "version": "2.117.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -20,15 +20,15 @@
20
20
  "@types/wait-on": "^5.2.0"
21
21
  },
22
22
  "dependencies": {
23
- "@tinkoff/mocker": "2.1.5",
24
- "@tramvai/test-helpers": "2.112.0",
23
+ "@tinkoff/mocker": "2.1.6",
24
+ "@tramvai/test-helpers": "2.117.0",
25
25
  "env-ci": "^5.0.2",
26
26
  "utility-types": "^3.10.0",
27
27
  "wait-on": "^5.3.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@tinkoff/utils": "^2.1.2",
31
- "@tramvai/cli": "2.112.0",
31
+ "@tramvai/cli": "2.117.0",
32
32
  "tslib": "^2.4.0"
33
33
  },
34
34
  "license": "Apache-2.0",