1
0
Fork 0
mirror of synced 2024-06-23 08:30:31 +12:00

Fixing cypress test issues.

This commit is contained in:
mike12345567 2021-03-25 13:32:05 +00:00
parent 3bef238d55
commit 7c2ef4d43f
4 changed files with 12 additions and 13 deletions

View file

@ -174,7 +174,7 @@ exports.create = async function(ctx) {
await createEmptyAppPackage(ctx, newApplication) await createEmptyAppPackage(ctx, newApplication)
/* istanbul ignore next */ /* istanbul ignore next */
if (env.NODE_ENV !== "jest") { if (!env.isTest()) {
await createApp(appId) await createApp(appId)
} }
@ -204,8 +204,8 @@ exports.delete = async function(ctx) {
const db = new CouchDB(ctx.params.appId) const db = new CouchDB(ctx.params.appId)
const app = await db.get(ctx.params.appId) const app = await db.get(ctx.params.appId)
const result = await db.destroy() const result = await db.destroy()
/* istanbul ignore next */
if (env.NODE_ENV !== "jest") { if (!env.isTest()) {
await deleteApp(ctx.params.appId) await deleteApp(ctx.params.appId)
} }

View file

@ -1,8 +1,5 @@
const CouchDB = require("../../db") const CouchDB = require("../../db")
const { join } = require("../../utilities/centralPath") const { getComponentLibraryManifest } = require("../../utilities/fileSystem")
const { budibaseTempDir } = require("../../utilities/budibaseDir")
const fileSystem = require("../../utilities/fileSystem")
const env = require("../../environment")
exports.fetchAppComponentDefinitions = async function(ctx) { exports.fetchAppComponentDefinitions = async function(ctx) {
const appId = ctx.params.appId || ctx.appId const appId = ctx.params.appId || ctx.appId
@ -11,12 +8,8 @@ exports.fetchAppComponentDefinitions = async function(ctx) {
let componentManifests = await Promise.all( let componentManifests = await Promise.all(
app.componentLibraries.map(async library => { app.componentLibraries.map(async library => {
let manifest let manifest = await getComponentLibraryManifest(appId, library)
if (env.isDev() && !env.isTest()) {
manifest = require(join(budibaseTempDir(), library, "manifest.json"))
} else {
manifest = await fileSystem.getComponentLibraryManifest(appId, library)
}
return { return {
manifest, manifest,
library, library,

View file

@ -157,6 +157,10 @@ exports.downloadTemplate = async (type, name) => {
* Retrieves component libraries from object store (or tmp symlink if in local) * Retrieves component libraries from object store (or tmp symlink if in local)
*/ */
exports.getComponentLibraryManifest = async (appId, library) => { exports.getComponentLibraryManifest = async (appId, library) => {
const devPath = join(budibaseTempDir(), library, "manifest.json")
if (env.isDev() && fs.existsSync(devPath)) {
return require(devPath)
}
const path = join(appId, "node_modules", library, "package", "manifest.json") const path = join(appId, "node_modules", library, "package", "manifest.json")
let resp = await retrieve(ObjectStoreBuckets.APPS, path) let resp = await retrieve(ObjectStoreBuckets.APPS, path)
if (typeof resp !== "string") { if (typeof resp !== "string") {

View file

@ -49,6 +49,8 @@ const PUBLIC_BUCKETS = [ObjectStoreBuckets.APPS]
* @constructor * @constructor
*/ */
exports.ObjectStore = bucket => { exports.ObjectStore = bucket => {
console.log("CREATED OBJECT STORE")
console.trace()
if (env.SELF_HOSTED) { if (env.SELF_HOSTED) {
AWS.config.update({ AWS.config.update({
accessKeyId: env.MINIO_ACCESS_KEY, accessKeyId: env.MINIO_ACCESS_KEY,