From 3c9910c192d127fee89c9d7fb147088b3af34d3e Mon Sep 17 00:00:00 2001 From: Jerome Simeon Date: Sun, 28 Mar 2021 11:34:34 -0400 Subject: [PATCH] chore(test) Validation test cleanup Signed-off-by: Jerome Simeon --- .../data/{test4err.json => identifier1err.json} | 0 packages/concerto-core/test/1.0.0/data/test5.json | 4 ---- packages/concerto-core/test/1.0.0/data/test5a.json | 4 ---- packages/concerto-core/test/1.0.0/data/test5b.json | 4 ---- packages/concerto-core/test/1.0.0/data/test5c.json | 5 ----- packages/concerto-core/test/1.0.0/data/test5d.json | 5 ----- packages/concerto-core/test/1.0.0/data/test6.json | 4 ---- packages/concerto-core/test/1.0.0/data/test6a.json | 5 ----- packages/concerto-core/test/1.0.0/data/test7.json | 4 ---- packages/concerto-core/test/1.0.0/data/test8.json | 5 ----- .../test/1.0.0/models/identifier2.cto | 14 -------------- .../test/1.0.0/models/identifier3.cto | 6 ------ .../test/1.0.0/models/identifier4.cto | 5 ----- .../test/1.0.0/models/identifier5.cto | 9 --------- packages/concerto-core/test/1.0.0/validate.js | 12 +++++++++--- 15 files changed, 9 insertions(+), 77 deletions(-) rename packages/concerto-core/test/1.0.0/data/{test4err.json => identifier1err.json} (100%) delete mode 100644 packages/concerto-core/test/1.0.0/data/test5.json delete mode 100644 packages/concerto-core/test/1.0.0/data/test5a.json delete mode 100644 packages/concerto-core/test/1.0.0/data/test5b.json delete mode 100644 packages/concerto-core/test/1.0.0/data/test5c.json delete mode 100644 packages/concerto-core/test/1.0.0/data/test5d.json delete mode 100644 packages/concerto-core/test/1.0.0/data/test6.json delete mode 100644 packages/concerto-core/test/1.0.0/data/test6a.json delete mode 100644 packages/concerto-core/test/1.0.0/data/test7.json delete mode 100644 packages/concerto-core/test/1.0.0/data/test8.json delete mode 100644 packages/concerto-core/test/1.0.0/models/identifier2.cto delete mode 100644 packages/concerto-core/test/1.0.0/models/identifier3.cto delete mode 100644 packages/concerto-core/test/1.0.0/models/identifier4.cto delete mode 100644 packages/concerto-core/test/1.0.0/models/identifier5.cto diff --git a/packages/concerto-core/test/1.0.0/data/test4err.json b/packages/concerto-core/test/1.0.0/data/identifier1err.json similarity index 100% rename from packages/concerto-core/test/1.0.0/data/test4err.json rename to packages/concerto-core/test/1.0.0/data/identifier1err.json diff --git a/packages/concerto-core/test/1.0.0/data/test5.json b/packages/concerto-core/test/1.0.0/data/test5.json deleted file mode 100644 index 0c5dc01298..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test5.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$class": "org.test.T", - "name": "John" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/data/test5a.json b/packages/concerto-core/test/1.0.0/data/test5a.json deleted file mode 100644 index c06279f195..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test5a.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$class": "org.test.T1", - "name": "John" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/data/test5b.json b/packages/concerto-core/test/1.0.0/data/test5b.json deleted file mode 100644 index b70080b41c..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test5b.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$class": "org.test.T2", - "name": "John" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/data/test5c.json b/packages/concerto-core/test/1.0.0/data/test5c.json deleted file mode 100644 index b00e12234e..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test5c.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$class": "org.test.T1", - "name": "John", - "id": "123" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/data/test5d.json b/packages/concerto-core/test/1.0.0/data/test5d.json deleted file mode 100644 index 8971d10988..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test5d.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$class": "org.test.T2", - "name": "John", - "id": "123" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/data/test6.json b/packages/concerto-core/test/1.0.0/data/test6.json deleted file mode 100644 index 79be1c7e61..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test6.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$class": "org.test.C", - "name": "John" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/data/test6a.json b/packages/concerto-core/test/1.0.0/data/test6a.json deleted file mode 100644 index 572cb0150e..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test6a.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$class": "org.test.C", - "name": "John", - "foo": "123" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/data/test7.json b/packages/concerto-core/test/1.0.0/data/test7.json deleted file mode 100644 index 79be1c7e61..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test7.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$class": "org.test.C", - "name": "John" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/data/test8.json b/packages/concerto-core/test/1.0.0/data/test8.json deleted file mode 100644 index cc0a530fed..0000000000 --- a/packages/concerto-core/test/1.0.0/data/test8.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$class": "org.test.P1", - "pId": "111", - "name": "John" -} \ No newline at end of file diff --git a/packages/concerto-core/test/1.0.0/models/identifier2.cto b/packages/concerto-core/test/1.0.0/models/identifier2.cto deleted file mode 100644 index 8e116b7628..0000000000 --- a/packages/concerto-core/test/1.0.0/models/identifier2.cto +++ /dev/null @@ -1,14 +0,0 @@ -namespace org.test - -transaction T { - o String name -} - -transaction T1 identified by id extends T { - o String id -} - -transaction T2 identified by id { - o String name - o String id -} diff --git a/packages/concerto-core/test/1.0.0/models/identifier3.cto b/packages/concerto-core/test/1.0.0/models/identifier3.cto deleted file mode 100644 index 3f54e2e351..0000000000 --- a/packages/concerto-core/test/1.0.0/models/identifier3.cto +++ /dev/null @@ -1,6 +0,0 @@ -namespace org.test - -concept C identified by foo { - o String name - o String foo -} diff --git a/packages/concerto-core/test/1.0.0/models/identifier4.cto b/packages/concerto-core/test/1.0.0/models/identifier4.cto deleted file mode 100644 index ba8bc20c7e..0000000000 --- a/packages/concerto-core/test/1.0.0/models/identifier4.cto +++ /dev/null @@ -1,5 +0,0 @@ -namespace org.test - -concept C identified { - o String name -} diff --git a/packages/concerto-core/test/1.0.0/models/identifier5.cto b/packages/concerto-core/test/1.0.0/models/identifier5.cto deleted file mode 100644 index 4e17a0a35c..0000000000 --- a/packages/concerto-core/test/1.0.0/models/identifier5.cto +++ /dev/null @@ -1,9 +0,0 @@ -namespace org.test - -participant P identified by pId { - o String pId - o String name -} - -participant P1 extends P { -} diff --git a/packages/concerto-core/test/1.0.0/validate.js b/packages/concerto-core/test/1.0.0/validate.js index 15298bc26a..d4bdfec756 100644 --- a/packages/concerto-core/test/1.0.0/validate.js +++ b/packages/concerto-core/test/1.0.0/validate.js @@ -82,7 +82,7 @@ const positive = [{ ctoFiles: ['./models/identifier1.cto'], expected: './data/identifier1a.expect' }, { - name: 'user defined identified', + name: 'user defined identifier', sample: './data/identifier1b.json', ctoFiles: ['./models/identifier1.cto'], expected: './data/identifier1b.expect' @@ -99,6 +99,12 @@ const negative = [{ ctoFiles: ['./models/hierarchy2.cto'], error: 'Unexpected properties for type org.test.C: c, t', errorFunctional: 'Instance undefined has a property named c which is not declared in org.test.C' +}, { + name: 'user defined identifier', + sample: './data/identifier1err.json', + ctoFiles: ['./models/identifier1.cto'], + error: 'Invalid or missing identifier for Type A1 in namespace org.test', + errorFunctional: 'Instance org.test.A1#undefined has an empty identifier.', }]; describe('Validation (1.0.0)', () => { @@ -137,7 +143,7 @@ describe('Validation (1.0.0)', () => { try { await validateClassic(sample, ctoFiles); } catch (errorActual) { - errorActual.name.should.equal('ValidationException'); + //errorActual.name.should.equal('ValidationException'); errorActual.message.should.deep.equal(error); } }); @@ -146,7 +152,7 @@ describe('Validation (1.0.0)', () => { try { await validateFunctional(sample, ctoFiles); } catch (errorActual) { - errorActual.name.should.equal('ValidationException'); + // errorActual.name.should.equal('ValidationException'); errorActual.message.should.deep.equal(errorFunctional); } });