Browse Source

breaking tests

gh-pages
Michael Shanks 7 years ago
parent
commit
614e9dbfdd
  1. 1
      packages/server/appPackages/testApp/.gitignore
  2. BIN
      packages/server/appPackages/testApp/dist/package.tar.gz
  3. 2
      packages/server/appPackages/testApp/public/main/budibase-client.js
  4. 2
      packages/server/appPackages/testApp/public/main/clientAppDefinition.js
  5. 2
      packages/server/appPackages/testApp/public/unauthenticated/budibase-client.js
  6. 2
      packages/server/appPackages/testApp/public/unauthenticated/clientAppDefinition.js
  7. 4
      packages/server/tests/builder.spec.js
  8. 1
      packages/server/tests/createNewApp.js
  9. 4
      packages/server/tests/serveui.js
  10. 18
      packages/server/utilities/builder/buildApp.js
  11. 2
      packages/server/utilities/builder/index.js
  12. 8
      packages/server/utilities/targzAppPackage.js

1
packages/server/appPackages/testApp/.gitignore

@ -0,0 +1 @@
dist/

BIN
packages/server/appPackages/testApp/dist/package.tar.gz

Binary file not shown.

2
packages/server/appPackages/testApp/public/main/budibase-client.js

File diff suppressed because one or more lines are too long

2
packages/server/appPackages/testApp/public/main/clientAppDefinition.js

@ -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"}}

2
packages/server/appPackages/testApp/public/unauthenticated/budibase-client.js

File diff suppressed because one or more lines are too long

2
packages/server/appPackages/testApp/public/unauthenticated/clientAppDefinition.js

@ -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"}}

4
packages/server/tests/builder.spec.js

@ -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);

1
packages/server/tests/createNewApp.js

@ -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");

4
packages/server/tests/serveui.js

@ -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);

18
packages/server/utilities/builder/buildApp.js

@ -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));

2
packages/server/utilities/builder/index.js

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

8
packages/server/utilities/targzAppPackage.js

@ -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

Loading…
Cancel
Save