@carbonorm/carbonreact 3.3.6 → 3.3.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonorm/carbonreact",
3
- "version": "3.3.6",
3
+ "version": "3.3.8",
4
4
  "browser": "dist/index.umd.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "main": "dist/index.cjs.js",
@@ -1,8 +1,8 @@
1
1
  import fs from "fs";
2
2
  import {inspect} from "util";
3
- import {checkAllRequestsComplete, isVerbose} from "@carbonorm/carbonnode";
3
+ import {axiosInstance, checkAllRequestsComplete, isVerbose} from "@carbonorm/carbonnode";
4
4
  import {waitFor} from "@testing-library/react";
5
- import {validSQL} from "./validSQL";
5
+ import ValidSQL, {validSQL} from "./validSQL";
6
6
 
7
7
  export default function ({sqlDirectory = './logs/rest/', logsDirectory = './logs/tests/'}: {
8
8
  sqlDirectory?: string,
@@ -21,6 +21,18 @@ export default function ({sqlDirectory = './logs/rest/', logsDirectory = './logs
21
21
 
22
22
  expect(document).not.toBeNull();
23
23
 
24
+ axiosInstance.interceptors.response.use(
25
+ response => {
26
+
27
+ if (Array.isArray(response?.data?.sql)) {
28
+
29
+ ValidSQL(response.data.sql)
30
+
31
+ }
32
+
33
+ return response;
34
+ })
35
+
24
36
  // @link https://stackoverflow.com/questions/13542667/create-directory-when-writing-to-file-in-node-js
25
37
  const asyncFileLogging = async (...args) => fs.writeFileSync(
26
38
  logsFile(),
@@ -53,7 +65,7 @@ export default function ({sqlDirectory = './logs/rest/', logsDirectory = './logs
53
65
 
54
66
  }, {timeout: 3000, interval: 1000});
55
67
 
56
- const jsonSQL = JSON.stringify(validSQL, undefined, 2) ?? '';
68
+ const jsonSQL = JSON.stringify(validSQL, undefined, 2) ?? '{}';
57
69
 
58
70
  console.log('After each Test (' + expect.getState().currentTestName + ')', validSQL, expect.getState());
59
71