PR comments.
This commit is contained in:
parent
3eff4d85d0
commit
47260f23bf
|
@ -325,7 +325,7 @@ describe("/applications", () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("app sync", () => {
|
describe("POST /api/applications/:appId/sync", () => {
|
||||||
it("should not sync automation logs", async () => {
|
it("should not sync automation logs", async () => {
|
||||||
// setup the apps
|
// setup the apps
|
||||||
await config.createApp("testing-auto-logs")
|
await config.createApp("testing-auto-logs")
|
||||||
|
@ -344,19 +344,15 @@ describe("/applications", () => {
|
||||||
.expect(200)
|
.expect(200)
|
||||||
|
|
||||||
// does exist in prod
|
// does exist in prod
|
||||||
await context.doInAppContext(config.getProdAppId(), async () => {
|
const prodLogs = await config.getAutomationLogs()
|
||||||
const logs = await config.getAutomationLogs()
|
expect(prodLogs.data.length).toBe(1)
|
||||||
expect(logs.data.length).toBe(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
// delete prod app so we revert to dev log search
|
// delete prod app so we revert to dev log search
|
||||||
await config.unpublish()
|
await config.unpublish()
|
||||||
|
|
||||||
// doesn't exist in dev
|
// doesn't exist in dev
|
||||||
await context.doInAppContext(config.getAppId(), async () => {
|
const devLogs = await config.getAutomationLogs()
|
||||||
const logs = await config.getAutomationLogs()
|
expect(devLogs.data.length).toBe(0)
|
||||||
expect(logs.data.length).toBe(0)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {
|
||||||
basicScreen,
|
basicScreen,
|
||||||
basicLayout,
|
basicLayout,
|
||||||
basicWebhook,
|
basicWebhook,
|
||||||
basicAutomationLog,
|
basicAutomationResults,
|
||||||
} from "./structures"
|
} from "./structures"
|
||||||
import {
|
import {
|
||||||
constants,
|
constants,
|
||||||
|
@ -728,15 +728,17 @@ class TestConfiguration {
|
||||||
return await context.doInAppContext(this.getProdAppId(), async () => {
|
return await context.doInAppContext(this.getProdAppId(), async () => {
|
||||||
return await pro.sdk.automations.logs.storeLog(
|
return await pro.sdk.automations.logs.storeLog(
|
||||||
automation,
|
automation,
|
||||||
basicAutomationLog(automation._id!)
|
basicAutomationResults(automation._id!)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAutomationLogs() {
|
async getAutomationLogs() {
|
||||||
const now = new Date()
|
return context.doInAppContext(this.appId, async () => {
|
||||||
return await pro.sdk.automations.logs.logSearch({
|
const now = new Date()
|
||||||
startDate: new Date(now.getTime() - 100000).toISOString(),
|
return await pro.sdk.automations.logs.logSearch({
|
||||||
|
startDate: new Date(now.getTime() - 100000).toISOString(),
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,9 @@ export function collectAutomation(tableId?: string): Automation {
|
||||||
return automation as Automation
|
return automation as Automation
|
||||||
}
|
}
|
||||||
|
|
||||||
export function basicAutomationLog(automationId: string): AutomationResults {
|
export function basicAutomationResults(
|
||||||
|
automationId: string
|
||||||
|
): AutomationResults {
|
||||||
return {
|
return {
|
||||||
automationId,
|
automationId,
|
||||||
status: AutomationStatus.SUCCESS,
|
status: AutomationStatus.SUCCESS,
|
||||||
|
|
Loading…
Reference in New Issue