k8s-features
Version:
A Cucumber-js base library for Kubernetes Gherkin tests, with base world class, basic steps, reusable utility functions and k8s client
22 lines (20 loc) • 487 B
JavaScript
const { When } = require('@cucumber/cucumber');
When(
'resource {word} is deleted',
/**
* @this import("../support/world.cjs").MyWorld
* @param {string} alias
* @returns {Promise}
*/
async function (alias) {
const item = this.getItem(alias);
if (!item) {
throw new Error(`Item ${alias} is not declared`);
}
const obj = item.getObj();
if (!obj) {
throw new Error(`Item ${alias} does not exist`);
}
await this.delete(obj);
}
);