broken tests

This commit is contained in:
Michael Shanks 2020-03-11 17:07:18 +00:00
parent 51794f78a8
commit ad62a9c7d8
1 changed files with 25 additions and 0 deletions

View File

@ -10,11 +10,19 @@ const screen2 = require("../appPackages/testApp/pages/main/screens/screen2.json"
const { readJSON, pathExists, unlink, readFile } = require("fs-extra") const { readJSON, pathExists, unlink, readFile } = require("fs-extra")
const { getHashedCssPaths } = require("../utilities/builder/convertCssToFiles") const { getHashedCssPaths } = require("../utilities/builder/convertCssToFiles")
const listScreens = require("../utilities/builder/listScreens") const listScreens = require("../utilities/builder/listScreens")
const { getApisWithFullAccess } = require("../utilities/budibaseApi")
const app = require("./testApp")() const app = require("./testApp")()
testComponents.textbox.name = `./customComponents/textbox` testComponents.textbox.name = `./customComponents/textbox`
testMoreComponents.textbox.name = `./moreCustomComponents/textbox` testMoreComponents.textbox.name = `./moreCustomComponents/textbox`
let _master
const getmaster = async () => {
if (!_master)
_master = await getApisWithFullAccess({}, app.masterAppPackage)
return _master
}
beforeAll(async () => { beforeAll(async () => {
const testScreen = "./appPackages/testApp/pages/main/screens/newscreen.json" const testScreen = "./appPackages/testApp/pages/main/screens/newscreen.json"
const testScreenAfterMove = const testScreenAfterMove =
@ -24,6 +32,23 @@ beforeAll(async () => {
if (await pathExists(testScreenAfterMove)) await unlink(testScreenAfterMove) if (await pathExists(testScreenAfterMove)) await unlink(testScreenAfterMove)
await app.start() await app.start()
const response = await app
.post(`/_master/api/authenticate`, {
username: app.credentials.masterOwner.username,
password: app.credentials.masterOwner.password,
})
.expect(statusCodes.OK)
app.credentials.masterOwner.cookie = response.header["set-cookie"]
const master = await getmaster()
const newApp = master.recordApi.getNew("/applications", "application")
newApp.name = "testApp"
await app
.post(`/_master/api/record/${newApp.key}`, newApp)
.set("cookie", app.credentials.masterOwner.cookie)
.expect(statusCodes.OK)
}) })
afterAll(async () => await app.destroy()) afterAll(async () => await app.destroy())