-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api-page-builder-import-export): bg tasks for pages export and im…
…port (#3851)
- Loading branch information
1 parent
c0c5b23
commit 627d334
Showing
141 changed files
with
4,118 additions
and
2,085 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ITask, ITaskLog } from "@webiny/tasks"; | ||
import { createMockIdentity } from "~tests/mocks/identity"; | ||
|
||
export const createTaskLogMock = (task: Pick<ITask, "id">): ITaskLog => { | ||
return { | ||
id: "acustomtasklogid", | ||
createdOn: new Date().toISOString(), | ||
createdBy: createMockIdentity(), | ||
executionName: "acustomexecutionname", | ||
task: task.id, | ||
iteration: 1, | ||
items: [] | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { TaskManagerStore } from "@webiny/tasks/runner/TaskManagerStore"; | ||
import { Context, ITaskData } from "@webiny/tasks/types"; | ||
import { Context, ITask, ITaskLog } from "@webiny/tasks/types"; | ||
import { createTaskMock } from "~tests/mocks/task"; | ||
import { createContextMock } from "~tests/mocks/context"; | ||
import { createTaskLogMock } from "~tests/mocks/log"; | ||
|
||
interface Params { | ||
context?: Context; | ||
task?: ITaskData; | ||
task?: ITask; | ||
log?: ITaskLog; | ||
} | ||
export const createTaskManagerStoreMock = (params?: Params) => { | ||
const context = params?.context || createContextMock(); | ||
const task = params?.task || createTaskMock(); | ||
return new TaskManagerStore(context, task); | ||
const log = params?.log || createTaskLogMock(task); | ||
return new TaskManagerStore(context, task, log); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import { createMockIdentity } from "./identity"; | ||
import { ITaskData, TaskDataStatus } from "@webiny/tasks/types"; | ||
import { ITask, TaskDataStatus } from "@webiny/tasks/types"; | ||
|
||
export const createTaskMock = (task?: Partial<ITaskData>): ITaskData => { | ||
export const createTaskMock = (task?: Partial<ITask>): ITask => { | ||
return { | ||
id: "myCustomTaskDataId", | ||
definitionId: "myCustomTaskDefinition", | ||
input: {}, | ||
name: "A custom task defined via method", | ||
log: [], | ||
createdOn: new Date().toISOString(), | ||
savedOn: new Date().toISOString(), | ||
taskStatus: TaskDataStatus.PENDING, | ||
createdBy: createMockIdentity(), | ||
eventResponse: undefined, | ||
executionName: "mycustomexecutionname", | ||
iterations: 0, | ||
...task | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.