Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
refactor(engine) Rename 'generateText' to 'draft'
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <jeromesimeon@me.com>
  • Loading branch information
jeromesimeon committed Oct 29, 2019
1 parent 86c8ae8 commit c6671b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/ergo-cli/lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function loadTemplate(template, files) {
*/
class Commands {
/**
* Invoke generateText for an Ergo contract
* Invoke draft for an Ergo contract
*
* @param {string} template - template directory
* @param {string[]} files - input files
Expand All @@ -79,7 +79,7 @@ class Commands {
'template': true,
};
const engine = new Engine();
return engine.compileAndGenerateText(logicManager,contractJson,{},currentTime,markdownOtions);
return engine.compileAndDraft(logicManager,contractJson,{},currentTime,markdownOtions);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/ergo-engine/lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class Engine {
* @param {object} options to the text generation
* @return {Promise} a promise that resolves to a result for the clause initialization
*/
async generateText(logic, contractId, contract, params, currentTime, options) {
async draft(logic, contractId, contract, params, currentTime, options) {
options = options || {};

const defaultState = {
Expand Down Expand Up @@ -263,10 +263,10 @@ class Engine {
* @param {object} options to the text generation
* @return {Promise} a promise that resolves to a result for the clause initialization
*/
compileAndGenerateText(logic, contract, params, currentTime, options) {
compileAndDraft(logic, contract, params, currentTime, options) {
return logic.compileLogic(false).then(() => {
const contractId = logic.getContractName();
return this.generateText(logic, contractId, contract, params, currentTime, options);
return this.draft(logic, contractId, contract, params, currentTime, options);
});
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ergo-engine/test/commonengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ function runWorkload(Engine, target) {
if (test.clauseName) {
if (test.clauseName === 'generateText') {
if (Object.prototype.hasOwnProperty.call(expected, 'error')) {
return engine.compileAndGenerateText(logicManager, contractJson, {}, currentTime, options)
return engine.compileAndDraft(logicManager, contractJson, {}, currentTime, options)
.catch((actualError) => {
expect(actualError.message).to.equal(expected.error);
});
} else {
return engine.compileAndGenerateText(logicManager, contractJson, {}, currentTime, options)
return engine.compileAndDraft(logicManager, contractJson, {}, currentTime, options)
.then((actualAnswer) => {
return compareSuccess(expected, actualAnswer);
});
Expand Down

0 comments on commit c6671b9

Please sign in to comment.