From 7481d5771c081c8ef75bbd7ba813925b423406e9 Mon Sep 17 00:00:00 2001 From: Kathleen Tuite Date: Mon, 21 Aug 2023 13:00:59 -0700 Subject: [PATCH] Updated tests a little bit --- test/integration/api/datasets.js | 95 -------------------------- test/unit/data/schema.js | 111 +++++++++++++++++-------------- 2 files changed, 62 insertions(+), 144 deletions(-) diff --git a/test/integration/api/datasets.js b/test/integration/api/datasets.js index 820d7c878..23c7595c1 100644 --- a/test/integration/api/datasets.js +++ b/test/integration/api/datasets.js @@ -2080,98 +2080,6 @@ describe('datasets and entities', () => { }); })); - it.skip('should not break when a saveto/bind is on a field inside a repeat group', testService(async (service, container) => { - // Entities made from repeat groups are not yet supported. pyxform throws an error but central does not. - // When parsing the corresponding submission, it will pick the last item in the repeat group. - const form = ` - - - Repeat Children Entities - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `; - const sub = ` - 3 - - abby - - - benny - - - chelsea - - - uuid:05bba3e0-fd3b-415c-9123-0e22f010de80 - instance name - - - - - `; - const alice = await service.login('alice'); - await alice.post('/v1/projects/1/forms?publish=true') - .send(form) - .set('Content-Type', 'application/xml') - .expect(200); - await alice.post('/v1/projects/1/forms/repeat_entity/submissions') - .send(sub) - .set('Content-Type', 'application/xml') - .expect(200); - await exhaust(container); - await alice.get('/v1/projects/1/datasets/children/entities/a930397c-9f27-4f52-aed0-bb2d5bf4b018') - .expect(200) - .then(({ body }) => { - body.should.be.an.Entity(); - body.should.have.property('currentVersion').which.is.an.EntityDef(); - body.currentVersion.should.have.property('data').which.is.eql({ - num_children: '3', - child_name: 'chelsea' - }); - }); - })); - it('should throw an error when a saveto is on a field inside a repeat group', testService(async (service) => { // Entities made from repeat groups are not yet supported. pyxform also throws an error about this. const form = ` @@ -2182,9 +2090,6 @@ describe('datasets and entities', () => { - - - diff --git a/test/unit/data/schema.js b/test/unit/data/schema.js index e06507dfe..6eab1454d 100644 --- a/test/unit/data/schema.js +++ b/test/unit/data/schema.js @@ -569,7 +569,7 @@ describe('form schema', () => { }); }); - it.skip('should allow binds on fields in repeats even if functionality is not correct', () => { // gh cb#670 + it('should reject binds on fields in repeats', () => { // gh cb#670 const xml = ` @@ -615,64 +615,77 @@ describe('form schema', () => { `; - return getFormFields(xml).then((schema) => { - schema.should.eql([ - { name: 'name', path: '/name', type: 'string', order: 0, propertyName: 'parent_name' }, - { name: 'children', path: '/children', type: 'structure', order: 1 }, - { name: 'child', path: '/children/child', type: 'repeat', order: 2 }, - { name: 'name', path: '/children/child/name', type: 'string', order: 3, propertyName: 'child_name' }, - { name: 'toy', path: '/children/child/toy', type: 'repeat', order: 4 }, - { name: 'name', path: '/children/child/toy/name', type: 'string', order: 5 } - ]); - }); + return getFormFields(xml).should.be.rejected().then((p) => p.problemCode.should.equal(400.25)); }); - it('should allow binds on fields in repeats even if functionality is not correct', () => { // gh cb#670 + it('should reject binds on fields in nested repeats inside groups', () => { // gh cb#670 const xml = ` - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Repeat Children Entities + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - + + + + + + + + + + - - `; + + + `; return getFormFields(xml).should.be.rejected().then((p) => p.problemCode.should.equal(400.25)); }); });