Skip to content

Instantly share code, notes, and snippets.

@scastrec
Last active November 12, 2018 14:57
Show Gist options
  • Save scastrec/663bbb6406e2663e727ab0ceb194f4d1 to your computer and use it in GitHub Desktop.
Save scastrec/663bbb6406e2663e727ab0ceb194f4d1 to your computer and use it in GitHub Desktop.
This simple class helps testing Actions conversation
class Conv {
constructor() {
this.messages = [];
this.surface = {
capabilities : new Map()
};
this.closed = false;
}
addCapabilities(capabilities) {
capabilities.forEach(element => {
this.surface.capabilities.set(element);
});
};
ask(message) {
this.messages.push(message);
};
asked() {
return this.messages;
};
close(message) {
this.closed = true;
this.messages.push(message);
};
reset() {
this.messages.splice(0,messages.length);
console.log(this.surface);
this.surface.capabilities.splice(0,this.surface.capabilities.length)
};
isClose(){
return this.closed;
}
};
module.exports = Conv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment