Skip to content

Commit

Permalink
tests (cont/..): update the tests to use the new markdown-template (#794
Browse files Browse the repository at this point in the history
)

* tests: update the tests to use the new markdown-template

Signed-off-by: Dan Selman <danscode@selman.org>

* WIP: Fix models - add versioning

Signed-off-by: Martin Halford <martin@benext.io>

* WIP: Fix models

Signed-off-by: Martin Halford <martin@benext.io>

* test(core): more fixes from live coding

Signed-off-by: Matt Roberts <code@rbrts.uk>

* Fix more tests

Signed-off-by: Martin Halford <martin@benext.io>

* Add even more fixes

Signed-off-by: Martin Halford <martin@benext.io>

* feat(core): remove default runtime + fix tests

Signed-off-by: Matt Roberts <code@rbrts.uk>

* Fix all remaining tests in cicero-core, plus a couple in cicero-cli.

Signed-off-by: Martin Halford <martin@benext.io>

* bug(archive): create with metadata with target runtime only when specified

Signed-off-by: sanketshevkar <shevkar.sanket@gmail.com>

* tests(cli): remove feature tests

Signed-off-by: Matt Roberts <code@rbrts.uk>

---------

Signed-off-by: Dan Selman <danscode@selman.org>
Signed-off-by: Martin Halford <martin@benext.io>
Signed-off-by: Matt Roberts <code@rbrts.uk>
Signed-off-by: sanketshevkar <shevkar.sanket@gmail.com>
Co-authored-by: Dan Selman <danscode@selman.org>
Co-authored-by: Matt Roberts <code@rbrts.uk>
Co-authored-by: sanketshevkar <shevkar.sanket@gmail.com>
  • Loading branch information
4 people authored Sep 6, 2023
1 parent c9b8e79 commit 73f33ed
Show file tree
Hide file tree
Showing 349 changed files with 23,451 additions and 37,375 deletions.
27,316 changes: 18,528 additions & 8,788 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion packages/cicero-cli/.cucumber.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cicero-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require('yargs')
yargs.option('target', {
describe: 'the target language of the archive',
type: 'string',
default: 'ergo'
default: null
});
yargs.option('output', {
describe: 'file name for new archive',
Expand Down
8 changes: 2 additions & 6 deletions packages/cicero-cli/lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,14 @@ class Commands {
* @returns {object} a modfied argument object
*/
static validateArchiveArgs(argv) {
argv = Commands.validateCommonArgs(argv);

argv.target = 'cicero';

return argv;
return Commands.validateCommonArgs(argv);
}

/**
* Create an archive using a template
*
* @param {string} templatePath - path to the template directory or archive
* @param {string} target - target language for the archive (should be either 'ergo' or 'cicero')
* @param {string} target - target language for the archive
* @param {string} outputPath - to the archive file
* @param {Object} [options] - an optional set of options
* @returns {object} Promise to the code creating an archive
Expand Down
4 changes: 1 addition & 3 deletions packages/cicero-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
"lint": "eslint .",
"postlint": "npm run licchk",
"licchk": "license-check-and-add check -f ../../license.config.json",
"test:cucumber": "cucumber-js test/features --require .cucumber.js --world-parameters \"{\\\"rootdir\\\":\\\"./test\\\"}\"",
"test:mocha": "mocha --timeout 30000",
"test:all": "npm run test:mocha && npm run test:cucumber",
"test:all": "npm run test:mocha",
"test:windows": "npm run test:all",
"test:cov": "nyc npm run test",
"test": "npm run test:all"
Expand Down Expand Up @@ -53,7 +52,6 @@
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"chai-things": "0.2.0",
"cucumber": "5.1.0",
"eslint": "^8.43.0",
"jsdoc": "^4.0.2",
"license-check-and-add": "4.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/cicero-cli/test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ describe('#archive', async () => {
const options = {
keystore: keystore
};
const result = await Commands.archive(template, 'ergo', archiveName, options);
const result = await Commands.archive(template, null, archiveName, options);
result.should.eql(true);
const newTemplate = await Template.fromArchive(fs.readFileSync(archiveName));
newTemplate.should.not.be.null;
Expand Down
9 changes: 0 additions & 9 deletions packages/cicero-cli/test/data/helloemit/logic/logic.ergo

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* limitations under the License.
*/

concerto version ">= 1.0.0"
concerto version "^3.0.0"

namespace org.accordproject.contract
namespace org.accordproject.contract@0.2.0

/**
* Contract Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
* limitations under the License.
*/

concerto version ">= 1.0.0"
concerto version "^3.0.0"

namespace org.accordproject.runtime
namespace org.accordproject.runtime@0.2.0

import org.accordproject.contract.Contract from https://models.accordproject.org/accordproject/contract.cto
import org.accordproject.contract@0.2.0.Contract from https://models.accordproject.org/accordproject/contract@0.2.0.cto

/**
* Runtime API
Expand Down
27 changes: 14 additions & 13 deletions packages/cicero-cli/test/data/helloemit/model/model.cto
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
namespace org.accordproject.helloemit
namespace org.accordproject.helloemit@1.0.0

import org.accordproject.contract.* from https://models.accordproject.org/accordproject/contract.cto
import org.accordproject.runtime.* from https://models.accordproject.org/accordproject/runtime.cto
import org.accordproject.contract@0.2.0.{Clause, Contract} from https://models.accordproject.org/accordproject/contract@0.2.0.cto
import org.accordproject.runtime@0.2.0.{Request, Response, State, Obligation} from https://models.accordproject.org/accordproject/runtime@0.2.0.cto

/**
* The template model
*/
@template
asset TemplateModel extends Clause {
/**
* The name for the clause
*/
o String name
}

transaction MyRequest extends Request {
o String input
Expand All @@ -14,13 +25,3 @@ transaction MyResponse extends Response {
event Greeting {
o String message
}

/**
* The template model
*/
asset TemplateModel extends Clause {
/**
* The name for the clause
*/
o String name
}
2 changes: 1 addition & 1 deletion packages/cicero-cli/test/data/helloemit/request.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$class": "org.accordproject.helloemit.MyRequest",
"$class": "org.accordproject.helloemit@1.0.0.MyRequest",
"input": "World"
}
6 changes: 0 additions & 6 deletions packages/cicero-cli/test/data/helloworldstate/data.json

This file was deleted.

37 changes: 0 additions & 37 deletions packages/cicero-cli/test/data/helloworldstate/logic/logic.ergo

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* limitations under the License.
*/

concerto version ">= 1.0.0"
concerto version "^3.0.0"

namespace org.accordproject.contract
namespace org.accordproject.contract@0.2.0

/**
* Contract Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
* limitations under the License.
*/

concerto version ">= 1.0.0"
concerto version "^3.0.0"

namespace org.accordproject.runtime
namespace org.accordproject.runtime@0.2.0

import org.accordproject.contract.Contract from https://models.accordproject.org/accordproject/contract.cto
import org.accordproject.contract@0.2.0.Contract from https://models.accordproject.org/accordproject/contract@0.2.0.cto

/**
* Runtime API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
concerto version "^3.0.0"

namespace org.accordproject.money
namespace org.accordproject.money@0.3.0

/**
* Represents an amount of Cryptocurrency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
concerto version "^3.0.0"

namespace org.accordproject.time
namespace org.accordproject.time@0.3.0

/**
* Months of the year
Expand Down
7 changes: 4 additions & 3 deletions packages/cicero-cli/test/data/helloworldstate/model/model.cto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace org.accordproject.helloworldstate
namespace org.accordproject.helloworldstate@1.0.0

import org.accordproject.contract.* from https://models.accordproject.org/accordproject/contract.cto
import org.accordproject.runtime.* from https://models.accordproject.org/accordproject/runtime.cto
import org.accordproject.contract@0.2.0.{Clause, Contract} from https://models.accordproject.org/accordproject/contract@0.2.0.cto
import org.accordproject.runtime@0.2.0.{Request, Response, State} from https://models.accordproject.org/accordproject/runtime@0.2.0.cto

transaction MyRequest extends Request {
o String input
Expand All @@ -18,6 +18,7 @@ asset HelloWorldState extends State {
/**
* The template model
*/
@template
asset HelloWorldClause extends Clause {
/**
* The name for the clause
Expand Down
14 changes: 1 addition & 13 deletions packages/cicero-cli/test/data/helloworldstate/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
{
"name": "helloworldstate",
"displayName": "Hello World State",
"version": "0.14.0",
"description": "This is the stateful Hello World of Accord Project Templates. Executing the clause will simply echo back the text that occurs after the string `Hello` prepended to text that is passed in the request along with the number of times the clause has been called.",
"author": "Accord Project",
"license": "Apache-2.0",
"accordproject": {
"template": "clause",
"cicero": "^0.24.0"
},
"keywords": ["hello", "world", "greet"]
}
{"name":"helloworldstate","displayName":"Hello World State","version":"0.14.0","description":"This is the stateful Hello World of Accord Project Templates. Executing the clause will simply echo back the text that occurs after the string `Hello` prepended to text that is passed in the request along with the number of times the clause has been called.","author":"Accord Project","license":"Apache-2.0","accordproject":{"template":"clause","cicero":"^0.24.0"},"keywords":["hello","world","greet"]}
1 change: 0 additions & 1 deletion packages/cicero-cli/test/data/helloworldstate/params.json

This file was deleted.

5 changes: 1 addition & 4 deletions packages/cicero-cli/test/data/helloworldstate/request.json
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
{
"$class": "org.accordproject.helloworldstate.MyRequest",
"input": "Accord Project"
}
{"$class":"org.accordproject.helloworldstate.MyRequest","input":"Accord Project"}
4 changes: 0 additions & 4 deletions packages/cicero-cli/test/data/helloworldstate/state.json

This file was deleted.

Binary file modified packages/cicero-cli/test/data/helloworldstate@0.14.0.cta
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
namespace org.accordproject.installmentsale
namespace org.accordproject.installmentsale@1.0.0

import org.accordproject.contract@0.2.0.Contract from https://models.accordproject.org/accordproject/contract@0.2.0.cto
import org.accordproject.runtime@0.2.0.{Request, Response, Obligation, State} from https://models.accordproject.org/accordproject/runtime@0.2.0.cto
import org.accordproject.money@0.3.0.MonetaryAmount from https://models.accordproject.org/money@0.3.0.cto

import org.accordproject.contract.* from https://models.accordproject.org/accordproject/contract.cto
import org.accordproject.runtime.* from https://models.accordproject.org/accordproject/runtime.cto
import org.accordproject.money.MonetaryAmount from https://models.accordproject.org/money@0.2.0.cto

transaction Installment extends Request {
o Double amount
Expand Down Expand Up @@ -47,6 +48,7 @@ asset InstallmentSaleState extends State {
/**
* The template model
*/
@template
asset InstallmentSaleContract extends Contract {
o String BUYER
o String SELLER
Expand Down
Loading

0 comments on commit 73f33ed

Please sign in to comment.