@carbonorm/carbonreact 3.3.5 → 3.3.7

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.5",
3
+ "version": "3.3.7",
4
4
  "browser": "dist/index.umd.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "main": "dist/index.cjs.js",
@@ -1,10 +1,13 @@
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
- export default function ({sqlDirectory = './logs/rest/', logsDirectory = './logs/tests/'}: { sqlDirectory?: string, logsDirectory?: string } = {}) {
7
+ export default function ({sqlDirectory = './logs/rest/', logsDirectory = './logs/tests/'}: {
8
+ sqlDirectory?: string,
9
+ logsDirectory?: string
10
+ } = {}) {
8
11
 
9
12
  const originalWindowLocation = window.location
10
13
 
@@ -18,6 +21,18 @@ export default function ({sqlDirectory = './logs/rest/', logsDirectory = './logs
18
21
 
19
22
  expect(document).not.toBeNull();
20
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
+
21
36
  // @link https://stackoverflow.com/questions/13542667/create-directory-when-writing-to-file-in-node-js
22
37
  const asyncFileLogging = async (...args) => fs.writeFileSync(
23
38
  logsFile(),
@@ -52,7 +67,7 @@ export default function ({sqlDirectory = './logs/rest/', logsDirectory = './logs
52
67
 
53
68
  const jsonSQL = JSON.stringify(validSQL, undefined, 2) ?? '';
54
69
 
55
- console.log('After each Test (' + expect.getState().currentTestName + ') + (' +jsonSQL+ ')', expect.getState());
70
+ console.log('After each Test (' + expect.getState().currentTestName + ')', validSQL, expect.getState());
56
71
 
57
72
  // restore `window.location` to the original `jsdom`
58
73
  // `Location` object