mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-11 14:20:07 +08:00
fix: Add operators used by validation to plugin imports.
This commit is contained in:
parent
693667db5b
commit
02abd41e8e
@ -71,8 +71,8 @@ test('set empty operators array if no operators on page', async () => {
|
||||
],
|
||||
};
|
||||
await buildPages({ components, context });
|
||||
expect(context.counters.clientOperatorTypes.getCounts()).toEqual({});
|
||||
expect(context.counters.serverOperatorTypes.getCounts()).toEqual({});
|
||||
expect(context.typeCounters.operators.client.getCounts()).toEqual({});
|
||||
expect(context.typeCounters.operators.server.getCounts()).toEqual({});
|
||||
});
|
||||
|
||||
test('count all operators for the page', async () => {
|
||||
@ -104,14 +104,14 @@ test('count all operators for the page', async () => {
|
||||
],
|
||||
};
|
||||
await buildPages({ components, context });
|
||||
expect(context.counters.clientOperatorTypes.getCounts()).toEqual({
|
||||
expect(context.typeCounters.operators.client.getCounts()).toEqual({
|
||||
_op_1: 3,
|
||||
_op_2: 1,
|
||||
_op_3: 1,
|
||||
_op_4: 1,
|
||||
_op_5: 1,
|
||||
});
|
||||
expect(context.counters.serverOperatorTypes.getCounts()).toEqual({});
|
||||
expect(context.typeCounters.operators.server.getCounts()).toEqual({});
|
||||
});
|
||||
|
||||
test('count requests operators as server operators', async () => {
|
||||
@ -150,12 +150,12 @@ test('count requests operators as server operators', async () => {
|
||||
],
|
||||
};
|
||||
await buildPages({ components, context });
|
||||
expect(context.counters.clientOperatorTypes.getCounts()).toEqual({
|
||||
expect(context.typeCounters.operators.client.getCounts()).toEqual({
|
||||
_op_1: 1,
|
||||
_op_2: 1,
|
||||
_op_3: 1,
|
||||
});
|
||||
expect(context.counters.serverOperatorTypes.getCounts()).toEqual({
|
||||
expect(context.typeCounters.operators.server.getCounts()).toEqual({
|
||||
_r_op_1: 1,
|
||||
});
|
||||
});
|
||||
@ -187,11 +187,11 @@ test('count request payload operators as client operators', async () => {
|
||||
],
|
||||
};
|
||||
await buildPages({ components, context });
|
||||
expect(context.counters.clientOperatorTypes.getCounts()).toEqual({
|
||||
expect(context.typeCounters.operators.client.getCounts()).toEqual({
|
||||
_r_op_1: 1,
|
||||
_op_1: 1,
|
||||
});
|
||||
expect(context.counters.serverOperatorTypes.getCounts()).toEqual({
|
||||
expect(context.typeCounters.operators.server.getCounts()).toEqual({
|
||||
_r_op_2: 1,
|
||||
});
|
||||
});
|
||||
|
@ -38,6 +38,10 @@ function buildTypeClass(
|
||||
function buildTypes({ components, context }) {
|
||||
const { typeCounters } = context;
|
||||
|
||||
// Add operators used by form validation
|
||||
typeCounters.operators.client.increment('_not');
|
||||
typeCounters.operators.client.increment('_type');
|
||||
|
||||
components.types = {
|
||||
actions: {},
|
||||
blocks: {},
|
||||
|
@ -17,7 +17,6 @@
|
||||
import generateImportFile from './generateImportFile.js';
|
||||
|
||||
async function writeOperatorImports({ components, context }) {
|
||||
// TODO: import _not and _type for validation.
|
||||
await context.writeBuildArtifact(
|
||||
'plugins/operatorsClient.js',
|
||||
generateImportFile({
|
||||
|
Loading…
Reference in New Issue
Block a user