Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((actualAnswer) => {
this.answer = actualAnswer;
expect(actualAnswer).to.have.property('state');
expect(actualAnswer).to.not.have.property('error');
return Util.compareSuccess({ state },actualAnswer);
});
});
Then('it should respond with', function (expectedResponse) {
const response = JSON.parse(expectedResponse);
if (this.answer) {
expect(this.answer).to.have.property('response');
expect(this.answer).to.not.have.property('error');
return Util.compareSuccess({ response },this.answer);
} else {
return trigger(this.engine,this.clause,this.request,this.state,this.currentTime)
.then((actualAnswer) => {
this.answer = actualAnswer;
expect(actualAnswer).to.have.property('response');
expect(actualAnswer).to.not.have.property('error');
return Util.compareSuccess({ response },actualAnswer);
});
}
});
Then('the contract data should be', async function (contractData) {
const expectedData = JSON.parse(contractData);
return Util.compareComponent(expectedData,this.clause.getData());
});
Given('that the contract data is', async function (contractData) {
const dataJson = JSON.parse(contractData);
if (!this.clause) {
const templateDir = Path.resolve(Util.resolveRootDir(this.parameters),'.');
const clause = await loadClause(templateDir);
this.request = clause.getTemplate().getMetadata().getRequest();
this.clause = clause;
}
this.clause.setData(dataJson);
});