Fix automation test

This commit is contained in:
Adria Navarro Redo 2023-01-26 11:38:21 +00:00 committed by adrinr
parent 9242470f6f
commit 6a4fe1d5e6
4 changed files with 30 additions and 5 deletions

View File

@ -13,4 +13,13 @@ const config: Config.InitialOptions = {
},
}
if (!process.env.CI) {
// use sources when not in CI
config.moduleNameMapper = {
"@budibase/types": "<rootDir>/../types/src",
}
} else {
console.log("Running tests with compiled dependency sources")
}
export default config

View File

@ -18,4 +18,20 @@ const config: Config.InitialOptions = {
},
}
if (!process.env.CI) {
// use sources when not in CI
config.moduleNameMapper = {
"@budibase/backend-core/(.*)": "<rootDir>/../backend-core/$1",
"@budibase/backend-core": "<rootDir>/../backend-core/src",
"@budibase/types": "<rootDir>/../types/src",
}
// add pro sources if they exist
if (fs.existsSync("../../../budibase-pro")) {
config.moduleNameMapper["@budibase/pro"] =
"<rootDir>/../../../budibase-pro/packages/pro/src"
}
} else {
console.log("Running tests with compiled dependency sources")
}
export default config

View File

@ -29,9 +29,9 @@ describe("Run through some parts of the automations system", () => {
afterAll(setup.afterAll)
it("should be able to init in builder", async () => {
await triggers.externalTrigger(basicAutomation(), { a: 1, appId: "app_123" })
await wait(100)
expect(thread.execute).toHaveBeenCalled()
await triggers.externalTrigger(basicAutomation(), { a: 1, appId: config.appId })
await wait(100)
expect(thread.execute).toHaveBeenCalled()
})
it("should check coercion", async () => {

View File

@ -399,11 +399,11 @@ class TestConfiguration {
// clear any old app
this.appId = null
// @ts-ignore
await context.updateAppId(null)
context.updateAppId(null)
this.app = await this._req({ name: appName }, null, controllers.app.create)
this.appId = this.app.appId
// @ts-ignore
await context.updateAppId(this.appId)
context.updateAppId(this.appId)
// create production app
this.prodApp = await this.publish()