@unito/integration-debugger
Version:
The Unito Integration Debugger
38 lines (37 loc) • 1.31 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const crawler_1 = require("../crawler");
/**
* Check: Delete Item that we previously created
*
* For example, if we executed a CreateItem step successfully, we might want to run a Delete - CreatedItem step to
* cleanup the test account
*/
const check = {
label: 'DeleteItem - Created Items',
prepareOnPreparedSteps: true,
validateOnError: false,
activatedByDefault: false,
prepare: async (stepResult, crawlerDriver) => {
const step = stepResult.step;
if (step.operation === crawler_1.Operation.CreateItem &&
crawlerDriver.getRelationSchema(step.schemaPath ?? '')?.canDeleteItem) {
const itemSummary = step.payloadOut;
return [
{
requestSchema: undefined,
schemaPath: step.schemaPath,
path: itemSummary.path,
operation: crawler_1.Operation.DeleteItem,
parentOperation: step.operation,
parentPath: step.path,
headersIn: step.headersIn,
warnings: [],
errors: [],
},
];
}
return [];
},
};
exports.default = check;
;