@tramvai/test-helpers 2.24.3 → 2.26.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/lib/index.es.js CHANGED
@@ -34,17 +34,7 @@ const renderFactory = (request) => async (path, { method = 'get', parserOptions,
34
34
  if (!parsedWithScripts) {
35
35
  return;
36
36
  }
37
- const scripts = parsedWithScripts.querySelectorAll('body > script');
38
- for (const script of scripts) {
39
- if (script.innerHTML.startsWith('var initialState')) {
40
- return JSON.parse(script.innerHTML
41
- .replace("var initialState = '", '')
42
- .replace(/'$/, '')
43
- .replace(/'/g, "\\\\'")
44
- .replace(/\\\\/g, '\\'));
45
- }
46
- }
47
- return null;
37
+ return JSON.parse(parsedWithScripts.querySelector('#__TRAMVAI_STATE__').textContent);
48
38
  },
49
39
  };
50
40
  };
package/lib/index.js CHANGED
@@ -42,17 +42,7 @@ const renderFactory = (request) => async (path, { method = 'get', parserOptions,
42
42
  if (!parsedWithScripts) {
43
43
  return;
44
44
  }
45
- const scripts = parsedWithScripts.querySelectorAll('body > script');
46
- for (const script of scripts) {
47
- if (script.innerHTML.startsWith('var initialState')) {
48
- return JSON.parse(script.innerHTML
49
- .replace("var initialState = '", '')
50
- .replace(/'$/, '')
51
- .replace(/'/g, "\\\\'")
52
- .replace(/\\\\/g, '\\'));
53
- }
54
- }
55
- return null;
45
+ return JSON.parse(parsedWithScripts.querySelector('#__TRAMVAI_STATE__').textContent);
56
46
  },
57
47
  };
58
48
  };
package/lib/wrapDi.d.ts CHANGED
@@ -12,6 +12,6 @@ export declare const getDiWrapper: ({ providers, modules, di, }?: Options) => {
12
12
  * @description Run specific command line
13
13
  * @param line one of the commandLineListTokens
14
14
  */
15
- runLine: (line: typeof commandLineListTokens[keyof typeof commandLineListTokens]) => Promise<any[]>;
15
+ runLine: (line: (typeof commandLineListTokens)[keyof typeof commandLineListTokens]) => Promise<any[]>;
16
16
  };
17
17
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/test-helpers",
3
- "version": "2.24.3",
3
+ "version": "2.26.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "build-for-publish": "true"
19
19
  },
20
20
  "dependencies": {
21
- "@tramvai/core": "2.24.3",
22
- "@tramvai/test-mocks": "2.24.3",
21
+ "@tramvai/core": "2.26.0",
22
+ "@tramvai/test-mocks": "2.26.0",
23
23
  "@types/express": "^4.17.1",
24
24
  "@types/supertest": "^2.0.11",
25
25
  "fastify": "^3.29.0",
@@ -27,8 +27,8 @@
27
27
  "supertest": "^6.1.3"
28
28
  },
29
29
  "peerDependencies": {
30
- "@tinkoff/dippy": "0.8.3",
31
- "tslib": "^2.0.3"
30
+ "@tinkoff/dippy": "0.8.5",
31
+ "tslib": "^2.4.0"
32
32
  },
33
33
  "devDependencies": {},
34
34
  "license": "Apache-2.0",