fix(blocks-basic): Refactored tests to use new Block config.

This commit is contained in:
Sandile 2022-01-14 11:15:14 +02:00
parent 1919560235
commit 37ba69dd60
8 changed files with 68 additions and 37 deletions

View File

@ -17,11 +17,14 @@
import { runBlockSchemaTests, runRenderTests } from '@lowdefy/block-dev';
import Block from './Anchor.js';
import block from './index.js';
import examples from './examples.yaml';
import schema from './schema.json';
const { meta, tests } = block;
const testConfig = {
validation: true,
required: true,
values: [],
};
runRenderTests({ examples, Block, meta, schema, tests });
runBlockSchemaTests({ examples, meta, schema });
runRenderTests({ Block, examples, schema, testConfig });
runBlockSchemaTests({ examples, schema });

View File

@ -21,14 +21,18 @@ import userEvent from '@testing-library/user-event';
import Block from './Box.js';
import examples from './examples.yaml';
import block from './index.js';
import schema from './schema.json';
const { meta, tests } = block;
runRenderTests({ examples, Block, meta, schema, tests });
runBlockSchemaTests({ examples, meta, schema });
const testConfig = {
validation: true,
required: true,
values: [],
};
const { before, methods, getProps } = mockBlock({ meta, schema });
runRenderTests({ Block, examples, schema, testConfig });
runBlockSchemaTests({ examples, schema });
const { before, methods, getProps } = mockBlock({ meta: Block.meta, schema });
beforeEach(before);
test('triggerEvent onClick', () => {

View File

@ -20,14 +20,18 @@ import { render } from '@testing-library/react';
import Block from './DangerousHtml.js';
import examples from './examples.yaml';
import block from './index.js';
import schema from './schema.json';
const { meta, tests } = block;
runRenderTests({ examples, Block, meta, schema, tests });
runBlockSchemaTests({ examples, meta, schema });
const testConfig = {
validation: true,
required: true,
values: [],
};
const { before, methods, getProps } = mockBlock({ meta, schema });
runRenderTests({ Block, examples, schema, testConfig });
runBlockSchemaTests({ examples, schema });
const { before, methods, getProps } = mockBlock({ meta: Block.meta, schema });
beforeEach(before);
test('update on properties.html change', () => {

View File

@ -20,14 +20,18 @@ import { render } from '@testing-library/react';
import Block from './Html.js';
import examples from './examples.yaml';
import block from './index.js';
import schema from './schema.json';
const { meta, tests } = block;
runRenderTests({ examples, Block, meta, schema, tests });
runBlockSchemaTests({ examples, meta, schema });
const testConfig = {
validation: true,
required: true,
values: [],
};
const { before, methods, getProps } = mockBlock({ meta, schema });
runRenderTests({ Block, examples, schema, testConfig });
runBlockSchemaTests({ examples, schema });
const { before, methods, getProps } = mockBlock({ meta: Block.meta, schema });
beforeEach(before);
test('update on properties.html change', () => {

View File

@ -18,9 +18,13 @@ import { runBlockSchemaTests, runRenderTests } from '@lowdefy/block-dev';
import Block from './Icon.js';
import examples from './examples.yaml';
import block from './index.js';
import schema from './schema.json';
const { meta, tests } = block;
runRenderTests({ examples, Block, meta, schema, tests });
runBlockSchemaTests({ examples, meta, schema });
const testConfig = {
validation: true,
required: true,
values: [],
};
runRenderTests({ Block, examples, schema, testConfig });
runBlockSchemaTests({ examples, schema });

View File

@ -21,14 +21,18 @@ import userEvent from '@testing-library/user-event';
import Block from './Img.js';
import examples from './examples.yaml';
import block from './index.js';
import schema from './schema.json';
const { meta, tests } = block;
runRenderTests({ examples, Block, meta, schema, tests });
runBlockSchemaTests({ examples, meta, schema });
const testConfig = {
validation: true,
required: true,
values: [],
};
const { before, methods, getProps } = mockBlock({ meta, schema });
runRenderTests({ Block, examples, schema, testConfig });
runBlockSchemaTests({ examples, schema });
const { before, methods, getProps } = mockBlock({ meta: Block.meta, schema });
beforeEach(before);
test('triggerEvent onClick', () => {

View File

@ -21,14 +21,18 @@ import userEvent from '@testing-library/user-event';
import Block from './List.js';
import examples from './examples.yaml';
import block from './index.js';
import schema from './schema.json';
const { meta, tests } = block;
runRenderTests({ examples, Block, meta, schema, tests });
runBlockSchemaTests({ examples, meta, schema });
const testConfig = {
validation: true,
required: true,
values: [],
};
const { before, methods, getProps } = mockBlock({ meta, schema });
runRenderTests({ Block, examples, schema, testConfig });
runBlockSchemaTests({ examples, schema });
const { before, methods, getProps } = mockBlock({ meta: Block.meta, schema });
beforeEach(before);
test('triggerEvent onClick', () => {

View File

@ -21,14 +21,18 @@ import userEvent from '@testing-library/user-event';
import Block from './Span.js';
import examples from './examples.yaml';
import block from './index.js';
import schema from './schema.json';
const { meta, tests } = block;
runRenderTests({ examples, Block, meta, schema, tests });
const testConfig = {
validation: true,
required: true,
values: [],
};
runRenderTests({ Block, examples, schema, testConfig });
runBlockSchemaTests({ examples, schema });
const { before, methods, getProps } = mockBlock({ meta, schema });
const { before, methods, getProps } = mockBlock({ meta: Block.meta, schema });
beforeEach(before);
test('triggerEvent onClick', () => {