Skip to content

Commit

Permalink
feat: Export buildTestPage, add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTolmay committed May 25, 2022
1 parent a9c7ec4 commit bc9f16c
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 1 deletion.
95 changes: 95 additions & 0 deletions packages/build/src/build/buildPages/buildTestPage.test.js
@@ -0,0 +1,95 @@
/*
Copyright 2020-2022 Lowdefy, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import buildTestPage from './buildTestPage.js';

test('buildTestPage', () => {
const pageConfig = {
id: 'page',
type: 'Box',
requests: [
{
id: 'request',
type: 'AxiosHttp',
connectionId: 'axios',
},
],
blocks: [
{
id: 'box',
type: 'Box',
blocks: [
{ id: 'input', type: 'TextInput' },
{ id: 'box', type: 'Box' },
],
},
],
};
const res = buildTestPage({ pageConfig });
expect(res).toEqual({
id: 'page:page',
pageId: 'page',
blockId: 'page',
type: 'Box',
auth: {
public: true,
},
operators: [],
requests: [
{
id: 'request:page:request',
requestId: 'request',
pageId: 'page',
type: 'AxiosHttp',
connectionId: 'axios',
payload: {},
auth: {
public: true,
},
},
],

areas: {
content: {
blocks: [
{
areas: {
content: {
blocks: [
{
blockId: 'input',
id: 'block:page:input:0',
type: 'TextInput',
},

{
blockId: 'box',
id: 'block:page:box:1',
type: 'Box',
},
],
},
},

blockId: 'box',
id: 'block:page:box:0',
type: 'Box',
},
],
},
},
});
});
20 changes: 20 additions & 0 deletions packages/build/src/defaultTypesMap.json
@@ -0,0 +1,20 @@
{
"actions": {},
"auth": {
"callbacks": {},
"events": {},
"providers": {}
},
"blocks": {},
"connections": {},
"icons": {},
"operators": {
"client": {},
"server": {}
},
"requests": {},
"styles": {
"packages": {},
"blocks": {}
}
}
3 changes: 2 additions & 1 deletion packages/build/src/index.js
Expand Up @@ -26,6 +26,7 @@ import buildImports from './build/buildImports/buildImports.js';
import buildMenu from './build/buildMenu.js';
import buildPages from './build/buildPages/buildPages.js';
import buildRefs from './build/buildRefs/buildRefs.js';
import buildTestPage from './build/buildPages/buildTestPage.js';
import buildTypes from './build/buildTypes.js';
import cleanBuildDirectory from './build/cleanBuildDirectory.js';
import copyPublicFolder from './build/copyPublicFolder.js';
Expand Down Expand Up @@ -72,6 +73,6 @@ async function build(options) {
await copyPublicFolder({ components, context });
}

export { createPluginTypesMap };
export { buildTestPage, createPluginTypesMap };

export default build;

0 comments on commit bc9f16c

Please sign in to comment.