Skip to content

Commit

Permalink
(fix) Fixes packages and tests for new version number 0.5.0
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <[email protected]>
  • Loading branch information
jeromesimeon committed Aug 2, 2018
1 parent 73b8ab9 commit b30d9b4
Show file tree
Hide file tree
Showing 32 changed files with 48 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"$class":"org.accordproject.latedeliveryandpenalty.TemplateModel","clauseId":"d6752d72-04c4-4192-b85e-490507ff791e","forceMajeure":true,"penaltyDuration":{"$class":"org.accordproject.time.Duration","amount":9,"unit":"days"},"penaltyPercentage":7,"capPercentage":2,"termination":{"$class":"org.accordproject.time.Duration","amount":2,"unit":"weeks"},"fractionalPart":"days"}
{"$class":"org.accordproject.latedeliveryandpenalty.TemplateModel","clauseId":"4efde0f6-06be-415e-ae0e-8e0ef21af65f","forceMajeure":true,"penaltyDuration":{"$class":"org.accordproject.time.Duration","amount":9,"unit":"days"},"penaltyPercentage":7,"capPercentage":2,"termination":{"$class":"org.accordproject.time.Duration","amount":2,"unit":"weeks"},"fractionalPart":"days"}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
3 changes: 2 additions & 1 deletion packages/cicero-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"!./node_modules/**/*",
"!./out/**/*",
"!./lib/tdl.js",
"!./lib/compiled_template.js"
"!./lib/compiled_template.js",
"!./umd/cicero.js"
],
"path": "header.txt",
"blocking": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"cicero": {
"template": "contract",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/bad-locale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/bad-logic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/bad-property/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/conga/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"cicero": {
"template": "contract",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/helloemit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
},
"scripts": {
"test": "mocha"
Expand Down
Binary file modified packages/cicero-core/test/data/latedeliveryandpenalty.cta
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/locales-conga/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/mix-logic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/no-concepts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/no-logic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-core/test/data/no-sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/cicero-core/test/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('Metadata', () => {
it('should return requested sample', () => {
const md = new Metadata({
name: 'template',
cicero: {language:'ergo',version:'^0.4.0-0'}
cicero: {language:'ergo',version:'^0.5.0'}
}, null, {
en: 'sample'
});
Expand All @@ -119,7 +119,7 @@ describe('Metadata', () => {
it('should return null if sample is not in the samples', () => {
const md = new Metadata({
name: 'template',
cicero: {template: 'contract',language:'ergo',version:'^0.4.0-0'}
cicero: {template: 'contract',language:'ergo',version:'^0.5.0'}
}, null, {});
should.not.exist(md.getSample('en'));
should.not.exist(md.getSample());
Expand All @@ -129,7 +129,7 @@ describe('Metadata', () => {
it('should return default sample if locale not specified', () => {
const md = new Metadata({
name: 'template',
cicero: {template: 'contract',language:'ergo',version:'^0.4.0-0'}
cicero: {template: 'contract',language:'ergo',version:'^0.5.0'}
}, null, {
default: 'sample'
});
Expand All @@ -142,21 +142,21 @@ describe('Metadata', () => {
it('should return default type', () => {
const md = new Metadata({
name: 'template',
cicero: {template: 'contract',language:'ergo',version:'^0.4.0-0'}
cicero: {template: 'contract',language:'ergo',version:'^0.5.0'}
}, null, {});
md.getTemplateType().should.be.equal(0);
});
it('should return for explicit contract type', () => {
const md = new Metadata({
name: 'template',
cicero: {template: 'contract',language:'ergo',version:'^0.4.0-0'}
cicero: {template: 'contract',language:'ergo',version:'^0.5.0'}
}, null, {});
md.getTemplateType().should.be.equal(0);
});
it('should return default type', () => {
const md = new Metadata({
name: 'template',
cicero: {template: 'clause',language:'ergo',version:'^0.4.0-0'}
cicero: {template: 'clause',language:'ergo',version:'^0.5.0'}
}, null, {});
md.getTemplateType().should.be.equal(1);
});
Expand Down
14 changes: 7 additions & 7 deletions packages/cicero-core/test/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,23 @@ describe('Template', () => {
describe('#fromUrl', () => {

it('should create a template from an archive at a given URL', async () => {
const url = 'https://templates.accordproject.org/archives/acceptance-of-delivery@0.2.0.cta';
const url = 'https://templates.accordproject.org/archives/acceptance-of-delivery@0.4.0.cta';
return Template.fromUrl(url, null).should.be.fulfilled;
});

it('should create a template from an archive at a given AP URL', async () => {
const url = 'ap://acceptance-of-delivery@0.2.0#hash';
const url = 'ap://acceptance-of-delivery@0.4.0#hash';
return Template.fromUrl(url, null).should.be.fulfilled;
});

it('should create a template from an archive at a given github URL', async () => {
const url = 'github://accordproject/cicero-template-library/master/build/archives/acceptance-of-delivery@0.2.0.cta';
const url = 'github://accordproject/cicero-template-library/master/build/archives/acceptance-of-delivery@0.4.0.cta';
return Template.fromUrl(url, {'encoding':null,'headers':{'Accept': '*/*','Accept-Encoding': 'deflate, gzip'}}).should.be.fulfilled;
});

it('should throw an error if creating a template from a wrong URL', async () => {
const url = 'https://templates.accordproject.org/archives/doesnotexist@0.2.0.cta';
return Template.fromUrl(url, null).should.be.rejectedWith('Request to URL [https://templates.accordproject.org/archives/doesnotexist@0.2.0.cta] returned with error code: 404');
const url = 'https://templates.accordproject.org/archives/doesnotexist@0.3.0.cta';
return Template.fromUrl(url, null).should.be.rejectedWith('Request to URL [https://templates.accordproject.org/archives/doesnotexist@0.3.0.cta] returned with error code: 404');
});

it('should throw an error if creating a template from a github URL to an archive with the wrong Cicero version', async () => {
Expand All @@ -215,7 +215,7 @@ describe('Template', () => {
'cicero': {
'template': 'clause',
'language': 'ergo',
'version': '^0.4.0'
'version': '^0.5.0'
}
},
null,
Expand Down Expand Up @@ -352,7 +352,7 @@ describe('Template', () => {
describe('#getHash', () => {
it('should return a SHA-256 hash', async () => {
const template = await Template.fromDirectory('./test/data/latedeliveryandpenalty');
template.getHash().should.equal('1675e0d354ceb91ec9b3fdcd33a8d62127425d7f48e31c892c18be2ba6ee9fe4');
template.getHash().should.equal('04fb59a60a81b940a4afc1eeff93d05718114667d44622c78d3b5458598e248e');
});
});

Expand Down
11 changes: 6 additions & 5 deletions packages/cicero-core/test/templatelibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,22 @@ describe('TemplateLibrary', () => {
templateIndex.should.not.have.property('[email protected]');
});

it('should retrieve latest version index for cicero version 0.4.4', async function() {
it('should retrieve latest version index for cicero version 0.5.0', async function() {
const templateLibrary = new TemplateLibrary();
const templateIndex = await templateLibrary.getTemplateIndex({latestVersion: true, ciceroVersion: '0.4.4'});
const templateIndex = await templateLibrary.getTemplateIndex({latestVersion: true, ciceroVersion: '0.5.0'});
templateIndex.should.not.have.property('[email protected]');
templateIndex.should.not.have.property('[email protected]');
templateIndex.should.have.property('[email protected]');
templateIndex.should.not.have.property('[email protected]');
templateIndex.should.have.property('[email protected]');
});
});

describe('#getTemplate', () => {

it('should retrieve a template', async function() {
const templateLibrary = new TemplateLibrary();
const template = await templateLibrary.getTemplate('ap://helloworld@0.2.0#bf7346e1f60a721f5641b03f1747f0de78c181c10cbb1d27c4caeb9f2957cfa0');
template.getIdentifier().should.equal('helloworld@0.2.0');
const template = await templateLibrary.getTemplate('ap://helloworld@0.3.0#3c4ecb4aa622df34472c2e1fe91132f79df9e6619df66b4430a01445759ed8fa');
template.getIdentifier().should.equal('helloworld@0.3.0');
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/cicero-engine/test/data/helloemit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
},
"scripts": {
"test": "mocha"
Expand Down
2 changes: 1 addition & 1 deletion packages/cicero-engine/test/data/helloworld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
},
"scripts": {
"test": "mocha"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"cicero": {
"template": "contract",
"language": "ergo",
"version": "^0.4.1"
"version": "^0.5.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"cicero": {
"template": "contract",
"language": "javascript",
"version": "^0.4.1"
"version": "^0.5.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-engine/test/data/no-logic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/cicero-engine/test/data/saft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"cicero": {
"template": "contract",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
},
"devDependencies": {
"chai": "^4.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
},
"scripts": {
"test": "mocha",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "javascript",
"version": "^0.4.0"
"version": "^0.5.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"cicero": {
"template": "clause",
"language": "ergo",
"version": "^0.4.0"
"version": "^0.5.0"
}
}

0 comments on commit b30d9b4

Please sign in to comment.