test(step): write test for updateFor method in model

This commit is contained in:
Ali BARIN
2024-11-06 12:43:01 +00:00
parent ff49c747ba
commit 970d926563
3 changed files with 112 additions and 7 deletions

View File

@@ -314,13 +314,13 @@ class Step extends Base {
}
async updateFor(user, newStepData) {
const { connectionId, appKey, key, parameters } = newStepData;
const { appKey = this.appKey, connectionId, key, parameters } = newStepData;
if (connectionId && (appKey || this.appKey)) {
if (connectionId && appKey) {
await user.authorizedConnections
.findOne({
id: connectionId,
key: appKey || this.appKey,
key: appKey,
})
.throwIfNotFound();
}
@@ -334,8 +334,8 @@ class Step extends Base {
}
const updatedStep = await this.$query().patchAndFetch({
key: key,
appKey: appKey,
key,
appKey,
connectionId: connectionId,
parameters: parameters,
status: 'incomplete',