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