1
0
Fork 0
mirror of synced 2024-06-29 11:31:06 +12:00

breaking tests

This commit is contained in:
Michael Shanks 2019-09-11 06:08:39 +01:00
parent fc651a10a1
commit 614e9dbfdd
12 changed files with 24 additions and 22 deletions

View file

@ -0,0 +1 @@
dist/

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
window['##BUDIBASE_APPDEFINITION##'] = {"hierarchy":{"name":"root","type":"root","children":[{"name":"customer","type":"record","fields":[{"name":"name","type":"string","typeOptions":{"maxLength":1000,"values":null,"allowDeclaredValuesOnly":false},"label":"name","getInitialValue":"default","getUndefinedValue":"default"}],"children":[{"name":"invoiceyooo","type":"record","fields":[{"name":"amount","type":"number","typeOptions":{"minValue":99999999999,"maxValue":99999999999,"decimalPlaces":2},"label":"amount","getInitialValue":"default","getUndefinedValue":"default"}],"children":[],"validationRules":[],"nodeId":2,"indexes":[],"allidsShardFactor":1,"collectionName":"invoices","isSingle":false}],"validationRules":[],"nodeId":1,"indexes":[],"allidsShardFactor":64,"collectionName":"customers","isSingle":false}],"pathMaps":[],"indexes":[],"nodeId":0},"componentLibraries":["./customComponents","./moreCustomComponents","budibase-standard-components"],"appRootPath":"","props":{"_component":"some_component"}}
window['##BUDIBASE_APPDEFINITION##'] = {"hierarchy":{"name":"root","type":"root","children":[{"name":"customer","type":"record","fields":[{"name":"name","type":"string","typeOptions":{"maxLength":1000,"values":null,"allowDeclaredValuesOnly":false},"label":"name","getInitialValue":"default","getUndefinedValue":"default"}],"children":[{"name":"invoiceyooo","type":"record","fields":[{"name":"amount","type":"number","typeOptions":{"minValue":99999999999,"maxValue":99999999999,"decimalPlaces":2},"label":"amount","getInitialValue":"default","getUndefinedValue":"default"}],"children":[],"validationRules":[],"nodeId":2,"indexes":[],"allidsShardFactor":1,"collectionName":"invoices","isSingle":false}],"validationRules":[],"nodeId":1,"indexes":[],"allidsShardFactor":64,"collectionName":"customers","isSingle":false}],"pathMaps":[],"indexes":[],"nodeId":0},"componentLibraries":["./customComponents","./moreCustomComponents","@budibase/standard-components"],"appRootPath":"","props":{"_component":"some_component"}}

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
window['##BUDIBASE_APPDEFINITION##'] = {"hierarchy":{"name":"root","type":"root","children":[{"name":"customer","type":"record","fields":[{"name":"name","type":"string","typeOptions":{"maxLength":1000,"values":null,"allowDeclaredValuesOnly":false},"label":"name","getInitialValue":"default","getUndefinedValue":"default"}],"children":[{"name":"invoiceyooo","type":"record","fields":[{"name":"amount","type":"number","typeOptions":{"minValue":99999999999,"maxValue":99999999999,"decimalPlaces":2},"label":"amount","getInitialValue":"default","getUndefinedValue":"default"}],"children":[],"validationRules":[],"nodeId":2,"indexes":[],"allidsShardFactor":1,"collectionName":"invoices","isSingle":false}],"validationRules":[],"nodeId":1,"indexes":[],"allidsShardFactor":64,"collectionName":"customers","isSingle":false}],"pathMaps":[],"indexes":[],"nodeId":0},"componentLibraries":["./customComponents","./moreCustomComponents","budibase-standard-components"],"appRootPath":"","props":{"_component":"some_other_component"}}
window['##BUDIBASE_APPDEFINITION##'] = {"hierarchy":{"name":"root","type":"root","children":[{"name":"customer","type":"record","fields":[{"name":"name","type":"string","typeOptions":{"maxLength":1000,"values":null,"allowDeclaredValuesOnly":false},"label":"name","getInitialValue":"default","getUndefinedValue":"default"}],"children":[{"name":"invoiceyooo","type":"record","fields":[{"name":"amount","type":"number","typeOptions":{"minValue":99999999999,"maxValue":99999999999,"decimalPlaces":2},"label":"amount","getInitialValue":"default","getUndefinedValue":"default"}],"children":[],"validationRules":[],"nodeId":2,"indexes":[],"allidsShardFactor":1,"collectionName":"invoices","isSingle":false}],"validationRules":[],"nodeId":1,"indexes":[],"allidsShardFactor":64,"collectionName":"customers","isSingle":false}],"pathMaps":[],"indexes":[],"nodeId":0},"componentLibraries":["./customComponents","./moreCustomComponents","@budibase/standard-components"],"appRootPath":"","props":{"_component":"some_other_component"}}

View file

@ -154,8 +154,8 @@ it("/savePackage should prepare all necessary client files", async () => {
expect(await pathExists(publicFolderMain("/lib/moreCustomComponents/index.js"))).toBe(true);
expect(await pathExists(publicFolderUnauth("/lib/moreCustomComponents/index.js"))).toBe(true);
expect(await pathExists(publicFolderMain("/lib/node_modules/budibase-standard-components/index.js"))).toBe(true);
expect(await pathExists(publicFolderUnauth("/lib/node_modules/budibase-standard-components/index.js"))).toBe(true);
expect(await pathExists(publicFolderMain("/lib/node_modules/@budibase/standard-components/dist/index.js"))).toBe(true);
expect(await pathExists(publicFolderUnauth("/lib/node_modules/@budibase/standard-components/dist/index.js"))).toBe(true);
expect(await pathExists(publicFolderUnauth("/budibase-client.js"))).toBe(true);
expect(await pathExists(publicFolderUnauth("/clientAppDefinition.js"))).toBe(true);

View file

@ -38,6 +38,7 @@ module.exports = (app) => {
let version1Key = "";
it("should be able to upload new version including package files", async () => {
jest.setTimeout(30000);
const master = await getmaster();
const version1 = master.recordApi
.getNew(`${newAppKey}/versions`, "version");

View file

@ -35,11 +35,11 @@ module.exports = (app) => {
});
it("should serve specified files when authenticated", async () => {
const response = await app.get("/testApp/app.js")
const response = await app.get("/testApp/budibase-client.js")
.set("cookie", app.credentials.testAppUser1.cookie)
.expect(statusCodes.OK);
const expectedFile = await readFile("appPackages/testApp/public/main/app.js", "utf8");
const expectedFile = await readFile("appPackages/testApp/public/main/budibase-client.js", "utf8");
expect(response.text).toBe(expectedFile);

View file

@ -7,7 +7,7 @@ const {
constants, copyFile, writeFile,
readFile
} = require("fs-extra");
const { join, resolve } = require("path");
const { join, resolve, dirname } = require("path");
const sqrl = require('squirrelly');
module.exports = async (config, appname, pages, appdefinition) => {
@ -41,7 +41,7 @@ const publicPath = (appPath, pageName) => join(appPath, "public", pageName);
const rootPath = (config, appname) => config.useAppRootPath ? `/${appname}` : "";
const copyClientLib = async (appPath, pageName) => {
var sourcepath = require.resolve("budibase-client",{
var sourcepath = require.resolve("@budibase/client",{
paths: [appPath]
});
var destPath = join(publicPath(appPath, pageName), "budibase-client.js");
@ -95,16 +95,12 @@ const buildClientAppDefinition = async (config, appname, appdefinition, appPath,
for(let lib of pages.componentLibraries) {
const info = await componentLibraryInfo(appPath, lib);
const libFile = info.components._lib || "index.js";
let source;
try {
source = join(info.libDir, libFile);
} catch(e) {
console.log(e);
}
const destDir = join(appPublicPath, "lib", info.libDir.replace(appPath, ""));
await ensureDir(destDir);
const source = join(info.libDir, libFile);
const moduleDir = join(appPublicPath, "lib", info.libDir.replace(appPath, ""));
const destPath = join(moduleDir, libFile);
const destPath = join(destDir, libFile);
await ensureDir(dirname(destPath));
componentLibraries.push(destPath);
let shouldCopy = !(await pathExists(destPath));

View file

@ -43,7 +43,7 @@ module.exports.getPackageForBuilder = async (config, appname) => {
derivedComponents: keyBy("name")(
await fetchDerivedComponents(appPath))
})
});
}

View file

@ -22,7 +22,11 @@ module.exports.createTarGzPackage = async (config, appName) => {
await unlink(packagePath);
}
await compress(appPath, packagePath);
try {
await compress(appPath, packagePath);
}catch(e){
console.log(e);
}
const size = (await stat(packagePath)).size;
return {size, path:packagePath};
}
@ -48,7 +52,7 @@ const compress = (src, dest) => new Promise((resolve, reject) => {
// ensure opts
opts = {src, dest};
opts.tar = {ignore: name => dirname(name).split(sep).pop() === "dist"};
opts.tar = {ignore: name => dirname(name).split(sep).pop() === "dist" || dirname(name).split(sep).pop() === "node_modules"};
opts.gz = opts.gz || {};
// default gzip config