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

View File

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

View File

@ -157,6 +157,10 @@ exports.downloadTemplate = async (type, name) => {
* Retrieves component libraries from object store (or tmp symlink if in local)
*/
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")
let resp = await retrieve(ObjectStoreBuckets.APPS, path)
if (typeof resp !== "string") {

View File

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