mirror of https://github.com/Budibase/budibase.git
15 changed files with 202 additions and 60 deletions
@ -0,0 +1,4 @@ |
|||||
|
{ |
||||
|
"_component": "./customComponents/textbox", |
||||
|
"label": "hello" |
||||
|
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
{ |
||||
|
"_component": "./moreCustomComponents/textbox", |
||||
|
"label": "hello" |
||||
|
} |
||||
Binary file not shown.
@ -0,0 +1,11 @@ |
|||||
|
{ |
||||
|
"textbox" : { |
||||
|
"path": "./textbox", |
||||
|
"name": "Textbox", |
||||
|
"description": "A text input, with a label", |
||||
|
"props": { |
||||
|
"label": "string" |
||||
|
}, |
||||
|
"tags": ["textboxt", "input", "text"] |
||||
|
} |
||||
|
} |
||||
@ -1,12 +0,0 @@ |
|||||
const Sequencer = require('@jest/test-sequencer').default; |
|
||||
|
|
||||
const testOrder = [""] |
|
||||
|
|
||||
class CustomSequencer extends Sequencer { |
|
||||
sort(tests) { |
|
||||
// Test structure information |
|
||||
// https://github.com/facebook/jest/blob/6b8b1404a1d9254e7d5d90a8934087a9c9899dab/packages/jest-runner/src/types.ts#L17-L21 |
|
||||
const copyTests = Array.from(tests); |
|
||||
return copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1)); |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,66 @@ |
|||||
|
|
||||
|
const testAppDef = require("../appPackages/testApp/appDefinition.json"); |
||||
|
const testAccessLevels = require("../appPackages/testApp/access_levels.json"); |
||||
|
const testPages = require("../appPackages/testApp/pages.json"); |
||||
|
const testComponents = require("../appPackages/testApp/customComponents/components.json"); |
||||
|
const testMoreComponents = require("../appPackages/testApp/moreCustomComponents/components.json"); |
||||
|
const statusCodes = require("../utilities/statusCodes"); |
||||
|
const derivedComponent1 = require("../appPackages/testApp/components/myTextBox.json"); |
||||
|
const derivedComponent2 = require("../appPackages/testApp/components/subfolder/otherTextBox.json"); |
||||
|
|
||||
|
const app = require("./testApp")(); |
||||
|
|
||||
|
beforeAll(async () => await app.start()); |
||||
|
afterAll(async () => await app.destroy()); |
||||
|
|
||||
|
|
||||
|
it("/apppackage should get appDefinition", async () => { |
||||
|
|
||||
|
const {body} = await app.get("/_builder/api/testApp/appPackage") |
||||
|
.expect(statusCodes.OK); |
||||
|
|
||||
|
expect(body.appDefinition).toEqual(testAppDef); |
||||
|
}); |
||||
|
|
||||
|
it("/apppackage should get access levels", async () => { |
||||
|
|
||||
|
const {body} = await app.get("/_builder/api/testApp/appPackage") |
||||
|
.expect(statusCodes.OK); |
||||
|
|
||||
|
expect(body.accessLevels).toEqual(testAccessLevels); |
||||
|
}); |
||||
|
|
||||
|
it("/apppackage should get pages", async () => { |
||||
|
|
||||
|
const {body} = await app.get("/_builder/api/testApp/appPackage") |
||||
|
.expect(statusCodes.OK); |
||||
|
expect(body.pages).toEqual(testPages); |
||||
|
}); |
||||
|
|
||||
|
it("/apppackage should get rootComponents", async () => { |
||||
|
|
||||
|
const {body} = await app.get("/_builder/api/testApp/appPackage") |
||||
|
.expect(statusCodes.OK); |
||||
|
|
||||
|
expect(body.rootComponents["./customComponents/textbox"]).toBeDefined(); |
||||
|
expect(body.rootComponents["./moreCustomComponents/textbox"]).toBeDefined(); |
||||
|
|
||||
|
expect(body.rootComponents["./customComponents/textbox"]) |
||||
|
.toEqual(testComponents.textbox); |
||||
|
|
||||
|
expect(body.rootComponents["./moreCustomComponents/textbox"]) |
||||
|
.toEqual(testMoreComponents.textbox); |
||||
|
}); |
||||
|
|
||||
|
it("/apppackage should get derivedComponents", async () => { |
||||
|
|
||||
|
const {body} = await app.get("/_builder/api/testApp/appPackage") |
||||
|
.expect(statusCodes.OK); |
||||
|
|
||||
|
const expectedComponents = { |
||||
|
"myTextBox" : {...derivedComponent1, _name:"myTextBox"}, |
||||
|
"subfolder/otherTextBox": {...derivedComponent2, _name:"subfolder/otherTextBox"} |
||||
|
}; |
||||
|
|
||||
|
expect(body.derivedComponents).toEqual(expectedComponents); |
||||
|
}); |
||||
Loading…
Reference in new issue