@lowdefy/block-dev 4.0.0-alpha.6 → 4.0.0-alpha.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.
@@ -15,12 +15,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  limitations under the License.
16
16
  */ import React from 'react';
17
17
  import { type } from '@lowdefy/helpers';
18
- import { render } from '@testing-library/react';
18
+ import { render, waitFor } from '@testing-library/react';
19
19
  import mockBlock from './mockBlock.js';
20
- const runMockRenderTests = ({ examples , logger , meta , mocks , reset =()=>null
21
- , schema })=>{
20
+ const runMockRenderTests = ({ Block: Block1 , examples , logger , mocks , reset =()=>null
21
+ , schema , testConfig , })=>{
22
22
  const { before , getProps } = mockBlock({
23
- meta,
23
+ meta: Block1.meta,
24
24
  logger,
25
25
  schema
26
26
  });
@@ -36,13 +36,16 @@ const runMockRenderTests = ({ examples , logger , meta , mocks , reset =()=>null
36
36
  makeCssClass.mockReset();
37
37
  makeCssClass.mockImplementation(makeCssImp);
38
38
  });
39
- const values = meta.values ? [
40
- type.enforceType(meta.valueType, null),
41
- ...meta.values
42
- ] : [
43
- type.enforceType(meta.valueType, null)
44
- ];
45
39
  examples.forEach((ex)=>{
40
+ const values = [
41
+ type.enforceType(Block1.meta.valueType, null)
42
+ ];
43
+ if (!type.isNone(ex.value)) {
44
+ values.push(ex.value);
45
+ }
46
+ if (type.isArray(testConfig.values)) {
47
+ values.push(...testConfig.values);
48
+ }
46
49
  values.forEach((value, v)=>{
47
50
  mocks.forEach((mock)=>{
48
51
  test(`Mock render - ${ex.id} - value[${v}] - ${mock.name}`, async ()=>{
@@ -59,7 +62,9 @@ const runMockRenderTests = ({ examples , logger , meta , mocks , reset =()=>null
59
62
  value: value
60
63
  }));
61
64
  };
62
- render(/*#__PURE__*/ _jsx(Shell, {}));
65
+ const { container } = render(/*#__PURE__*/ _jsx(Shell, {}));
66
+ await waitFor(()=>expect(container.firstChild).toMatchSnapshot()
67
+ );
63
68
  mockFns.forEach((mockFn)=>{
64
69
  expect(mockFn.mock.calls).toMatchSnapshot();
65
70
  });
@@ -17,10 +17,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
17
17
  import { render, waitFor } from '@testing-library/react';
18
18
  import { type } from '@lowdefy/helpers';
19
19
  import mockBlock from './mockBlock.js';
20
- const runRenderTests = ({ Block , examples , logger , meta , reset =()=>null
21
- , schema , tests , validationsExamples , })=>{
20
+ const runRenderTests = ({ Block , examples , logger , reset =()=>null
21
+ , schema , testConfig , validationsExamples , })=>{
22
22
  const { before , methods , getProps } = mockBlock({
23
- meta,
23
+ meta: Block.meta,
24
24
  logger,
25
25
  schema
26
26
  });
@@ -30,13 +30,13 @@ const runRenderTests = ({ Block , examples , logger , meta , reset =()=>null
30
30
  });
31
31
  examples.forEach((ex)=>{
32
32
  const values = [
33
- type.enforceType(meta.valueType, null)
33
+ type.enforceType(Block.meta.valueType, null)
34
34
  ];
35
35
  if (!type.isNone(ex.value)) {
36
36
  values.push(ex.value);
37
37
  }
38
- if (type.isArray(meta.values)) {
39
- values.push(...meta.values);
38
+ if (type.isArray(testConfig.values)) {
39
+ values.push(...testConfig.values);
40
40
  }
41
41
  values.forEach((value, v)=>{
42
42
  test(`Render ${ex.id} - value[${v}]`, async ()=>{
@@ -51,7 +51,7 @@ const runRenderTests = ({ Block , examples , logger , meta , reset =()=>null
51
51
  await waitFor(()=>expect(container.firstChild).toMatchSnapshot()
52
52
  );
53
53
  });
54
- if (tests && tests.validation) {
54
+ if (testConfig && testConfig.validation) {
55
55
  (validationsExamples || []).map((validationEx)=>{
56
56
  test(`Render validation.status = ${validationEx.status} ${ex.id} - value[${v}]`, async ()=>{
57
57
  // create shell to setup react hooks with getProps before render;
@@ -68,7 +68,7 @@ const runRenderTests = ({ Block , examples , logger , meta , reset =()=>null
68
68
  });
69
69
  });
70
70
  }
71
- if (tests && tests.required) {
71
+ if (testConfig && testConfig.required) {
72
72
  test(`Render required = true ${ex.id} - value[${v}]`, async ()=>{
73
73
  // create shell to setup react hooks with getProps before render;
74
74
  const Shell = ()=>/*#__PURE__*/ _jsx(Block, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/block-dev",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.7",
4
4
  "licence": "Apache-2.0",
5
5
  "description": "Lowdefy Block Development Tools",
6
6
  "homepage": "https://lowdefy.com",
@@ -37,26 +37,26 @@
37
37
  "swc": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start"
38
38
  },
39
39
  "dependencies": {
40
- "@emotion/jest": "11.5.0",
41
- "@lowdefy/block-utils": "4.0.0-alpha.6",
42
- "@lowdefy/helpers": "4.0.0-alpha.6",
43
- "@testing-library/dom": "8.10.1",
40
+ "@emotion/jest": "11.7.1",
41
+ "@lowdefy/block-utils": "4.0.0-alpha.7",
42
+ "@lowdefy/helpers": "4.0.0-alpha.7",
43
+ "@testing-library/dom": "8.11.3",
44
44
  "@testing-library/react": "13.0.0-alpha.4",
45
45
  "@testing-library/user-event": "14.0.0-alpha.14",
46
- "ajv": "8.8.2",
46
+ "ajv": "8.9.0",
47
47
  "ajv-errors": "3.0.0",
48
- "jest": "27.3.1",
48
+ "jest": "27.5.1",
49
49
  "jest-serializer-html": "7.1.0",
50
- "react": "18.0.0-alpha-327d5c484-20211106",
51
- "react-dom": "18.0.0-alpha-327d5c484-20211106",
50
+ "react": "18.0.0-rc.0",
51
+ "react-dom": "18.0.0-rc.0",
52
52
  "yaml-loader": "0.6.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@swc/cli": "0.1.55",
56
- "@swc/core": "1.2.130"
56
+ "@swc/core": "1.2.135"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "2530e31af795b6a3c75ac8f72c8dbe0ab5d1251b"
61
+ "gitHead": "52ec14639d00de910cf9b8ab25bf933ca891cff5"
62
62
  }